From patchwork Thu Sep 22 16:35:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 608258 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp509216pvb; Thu, 22 Sep 2022 11:44:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4plASVKo3l+4eQ9ycnGU4DOcK9vneVlKooZ228PfrKjqHpClMgXYo1nz6l4PNizgQyAzGZ X-Received: by 2002:ac8:5b53:0:b0:35b:a603:6cdf with SMTP id n19-20020ac85b53000000b0035ba6036cdfmr4092417qtw.357.1663872251028; Thu, 22 Sep 2022 11:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663872251; cv=none; d=google.com; s=arc-20160816; b=ehDjw9aueEucO/G/7tKvq2My392jGMzx6V2r5vdHk3N5YxieZk3IXU1oFcOgcKZtxA sSqR78UbWgZBSEGE7WpgvHAi9cNe+OZ77no1Ciaj6uIQMeu9SoBNMxiB9ntd17Dn8mEf aFmqVCO9/hOlF/2c/IiECwwtclpz13f7mLjwm7uaOKiA5gXkuB+vCqTspOKOiNBZs6mD W11tMWqtXonQWTPu8A6NXWka2PboESzNnQXaDFJEPI+5mQE94CF4vsl8QIXz9+0usrNR QXO5tuajFfSqHncwDxToXcy0ZOp9zzlCLgPVnpcthJxFt1UUkA95JYX5srA3CnHhWwzK yfAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UoIEVd6qFvT+Ln9sMhn/rS//C5+/7lw2UA59aXrFoHY=; b=jSsXQVLMb1VHLiK4Q7bt72HYxsxhPbPH4j5wPYRDpGdg4P4A4a/bBl+55no9BR/G7R ZpTMEXV6nDMbXADRfbKbfCzHkvCIbEimfvbF2hkeW6dOFzYM6Kfg5Q3Y/+9wsqBu2PrU NRwe2PUmO33zL+ss+SgQTO4b9h4gX4N7NWNTj5uZ7mXSzvX8DjUOjmag7lD2xQwiWoz3 kHEbP0XHRHt/9U0wKbX47dcMW9dOtIdTTfESa1sxqaM/cb5gTsF/yYh4pThXTew5VKR0 YKVgQMD63LPzRxC8xX0wgf2p/H3VB5Jk5ZKgvBjCOgv3uWQcTZOd0xIHiQiX2ZP7THMj yuog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iBqZAQda; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t7-20020a05621421a700b004ad1662b0c8si3245338qvc.381.2022.09.22.11.44.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Sep 2022 11:44:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iBqZAQda; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obRBC-00060p-Is for patch@linaro.org; Thu, 22 Sep 2022 14:44:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPBG-0002Dg-JV for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:10 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:44805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obPB9-0005SG-Ht for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:02 -0400 Received: by mail-wr1-x434.google.com with SMTP id c11so16386207wrp.11 for ; Thu, 22 Sep 2022 09:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date; bh=UoIEVd6qFvT+Ln9sMhn/rS//C5+/7lw2UA59aXrFoHY=; b=iBqZAQdapWw+yOXckE21PCWw0K6EQmPoWx5Y8IMKOQNWu60pzzI3nPOmpo6JXyTcGR mYlYPal3za3wH2a/slU3/yyScMhH0sTHSz8aU7lxk21ZKauYAxhiu2y5lg4RXsjW+A0T z08VpzH3SMJKQrZkbnNNZlQOWSAIprxw0UiCFTOtRV0A1aP6myvDXKFqdyVQ5Bqx3jNG gWP6FQjEKfS1+eOVjOm3bUWEx0+ziOUP3B0lS4nBjWf1l572aRPVQkWGTbdoVEEFlGEE b8WnLdVSGJ1r8ztNbmolUUF9VtMgx33tG2LX/ZzFY6JDSnfk80dE0ZWShh11+2HwV9xN e/ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date; bh=UoIEVd6qFvT+Ln9sMhn/rS//C5+/7lw2UA59aXrFoHY=; b=3BNzLrQSIxj26WbCRV1ubPSj5fHsFyBWS8xhV+Kegrhq0R5Jo0f5ICHmzbOOLBkqmO 6o8iv5ONJvopVkgs3oiTKxDHt4gqmlw2zAQik3/Vqin9I/TQmE1zOZ1KFPscLtkEuEZJ 02t3ksM20EqD6D8AgFHO7HkCucU2OSTWnebE+sVQEGkKZYvMe8FB8VYzAVfUlvBALX/d lCjVFdLb4y9OV+QhjdV7vkD2cIn4IHDpMo4uoxJWyiOhbIois13CxQcq+hipv66+FhFy u/unU9vewqB/WoeYRbRler7/oMnUFy9Ivc5joEfKG1unO/a7BBKrtBjl8JE6TTMYZt4m IY9g== X-Gm-Message-State: ACrzQf2ouyEBnyMumNbyb7oAGYIpXRVeddIQbuYfqknDQ4Q/BkCSguPm EF8Gfm73j8RO+0LusI1s4qta84UPo+HgAQ== X-Received: by 2002:a5d:528a:0:b0:225:4a8e:221e with SMTP id c10-20020a5d528a000000b002254a8e221emr2550970wrv.145.1663864557845; Thu, 22 Sep 2022 09:35:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id iw1-20020a05600c54c100b003b3401f1e24sm6452599wmb.28.2022.09.22.09.35.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:35:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/39] hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation Date: Thu, 22 Sep 2022 17:35:27 +0100 Message-Id: <20220922163536.1096175-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922163536.1096175-1-peter.maydell@linaro.org> References: <20220922163536.1096175-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The compiler isn't clever enough to figure 'width' is a constant, so help it by using a definitions instead. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Message-id: 20220819153931.3147384-10-peter.maydell@linaro.org --- hw/usb/hcd-ohci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 895b29fb865..5585fd32ccf 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -805,13 +805,14 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed) return 1; } +#define HEX_CHAR_PER_LINE 16 + static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len) { bool print16; bool printall; - const int width = 16; int i; - char tmp[3 * width + 1]; + char tmp[3 * HEX_CHAR_PER_LINE + 1]; char *p = tmp; print16 = !!trace_event_get_state_backends(TRACE_USB_OHCI_TD_PKT_SHORT); @@ -822,7 +823,7 @@ static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len) } for (i = 0; ; i++) { - if (i && (!(i % width) || (i == len))) { + if (i && (!(i % HEX_CHAR_PER_LINE) || (i == len))) { if (!printall) { trace_usb_ohci_td_pkt_short(msg, tmp); break;