From patchwork Fri Aug 19 15:39:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 598501 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1498969mae; Fri, 19 Aug 2022 08:42:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4TA/IkdMplUt0Ep8VA2vCh5Naez0oJRwATnLmjH3Mou1TWzAU7avSknJXqhyXvlRfCR0M2 X-Received: by 2002:ac8:5c8f:0:b0:344:7194:f49d with SMTP id r15-20020ac85c8f000000b003447194f49dmr6987697qta.355.1660923757409; Fri, 19 Aug 2022 08:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660923757; cv=none; d=google.com; s=arc-20160816; b=BWy6se2v2U2MbhfuEmkB9Cvvpky2cqSLsYygqj7xOCS7Z+hg6kgFY/Tp6To4EEHi7B giUwnhsnmbNsudD+3gmb7LD1VDvjX4PR64AfnJ16LdPOisZRxJRyK6JTd5LVEH0E6rq6 K+rbvWBcd44bIGwdFWyVg1daVg0BhSAufpdeiITXxvNkMZE8VDcYVCt4hLnsoE8WHCj1 +CkHdU2XEgCYVn0lmc3HE1B/FEPJh3tb+oPQQTyOga7KgKt8Cli0anr3e1Vv1AtvA30Y pZfVVKuUXNCJ9H9OYm0XaljrL1ke7YtgDjxDxuht+iLxFfxCrXUGaEyY6VNhIb9axFoS an2w== 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:cc:to :from:dkim-signature; bh=wicKql4I/h9UnyT0qeiWtm97WB3+4GVyQ+X7NhjeYE4=; b=r7zZJPwFTI/4ay7xQQpXE4traowY5H/DhJKZqMtSIr9uYNYfOQcDXJ9ORGzYuR0eja CahvPCGaUPjwh3kzCpIHwpk0vqXidZMNofnvmETfQZoAYNEPmu9gj1LLFbxFbTCJ9xpI 6AVXfvuybE2sZUt8rZmIvaSSrbWxPnahQJGiesAIsUiqfos7uUQ1ABVxAFQvE3o8R0eK SOFk4foxTIdzDIU3p+QWiRTkrZQD1pnZOv1dWd33t2y+pu0XQB1jcE8zVUjOZVYRQjHM bTfhvpyPj8sELkO2/o2IVQdYW0NvwKghfnA0Rb3uo4L2oU0KzMht9WjKryjCpyRBnrAc BXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A3+tajuM; 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 o15-20020ac87c4f000000b00344959f7832si2040450qtv.579.2022.08.19.08.42.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Aug 2022 08:42:37 -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=A3+tajuM; 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]:50080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP48r-0000bl-1D for patch@linaro.org; Fri, 19 Aug 2022 11:42:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP46C-0005lO-BM for qemu-devel@nongnu.org; Fri, 19 Aug 2022 11:39:53 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP468-00065d-Fz for qemu-devel@nongnu.org; Fri, 19 Aug 2022 11:39:52 -0400 Received: by mail-wr1-x431.google.com with SMTP id r16so5619983wrm.6 for ; Fri, 19 Aug 2022 08:39:48 -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:cc:to:from:from:to:cc; bh=wicKql4I/h9UnyT0qeiWtm97WB3+4GVyQ+X7NhjeYE4=; b=A3+tajuM/D+cBNz8wVn21umtZzep7yXocwXNlSjy9AmPvLeySUgvajsTefklCwaTPz A6S44opQ3e52W6gZaxmbVXXsVWsqyKcBRJZQqqSCbqw7EM1/1lnP1osx/9WeB9sAjeIG RX3Yluv1rRbWzX9Sn+kXVRiNwgwzaJ9kiiB9DxBgXo10xlV8TgEsYfLaPzPrnv6eccL/ lc7ovIH0eFtKCiIpbdAldAL9x6P6t+FB3O61h2OklmwHOO8kiPbhXtlN90u5TLASMwMh JaZG3cDHiW3MIHz0aAaKkpSHHqOma4HmFtSOxodLWFJHf4qt0l6mVo1Gi183PxgqZDeZ BbFg== 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:cc:to:from:x-gm-message-state:from:to:cc; bh=wicKql4I/h9UnyT0qeiWtm97WB3+4GVyQ+X7NhjeYE4=; b=fFB2vRz7L+oJ68mW7QbqiWwH6oi5zdySSO5YpP+iyqZlNpSjz6wU6XCxHvqSpTxufc Wkcm8f/GPiO7KJ1OL8JISTW4tZbewksJLHFu8eE3xP4jvCDb7AC+HNpB+DGJ3nXMOb5I At8uM1whNb52hEwutsnUD9VAdrBN0BYanFhk2OFQUYg50Xp4ArPv7UFljoLy2m9txgZY cD6VSMTPON5U2IHOHSRy5PVhAjLu1sWLFTaiZcTeyFXohTsxDMx5QAJTiAs1fL/du8J+ CTNqqcDRROK6rC/9QwT8tZinUvpk8g4bNiePW/S61ir0slnT17Z53PGFbNFffwLM/KTC cQow== X-Gm-Message-State: ACgBeo1GBegnedj0YpyzLdhVVRLb6TC3aseAz+L3XRLmIez5LyLjxqe/ /FieC3g284WIRIxEc+dX4SNOt/m2FUgivQ== X-Received: by 2002:a5d:48c5:0:b0:225:2f99:430d with SMTP id p5-20020a5d48c5000000b002252f99430dmr4769879wrs.358.1660923586670; Fri, 19 Aug 2022 08:39:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bi13-20020a05600c3d8d00b003a54109a6a0sm5558396wmb.3.2022.08.19.08.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 08:39:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Samuel Thibault , =?utf-8?q?Marc-Andr=C3=A9_L?= =?utf-8?q?ureau?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Daniel Henrique Barboza , David Gibson , Greg Kurz , Dmitry Fleytman , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org Subject: [PATCH v2 09/11] hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation Date: Fri, 19 Aug 2022 16:39:29 +0100 Message-Id: <20220819153931.3147384-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220819153931.3147384-1-peter.maydell@linaro.org> References: <20220819153931.3147384-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 --- 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;