From nobody Tue Feb 10 14:33:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660923786; cv=none; d=zohomail.com; s=zohoarc; b=nhu2Bg1J17ZkFIvHDZqPzNSj280s6gs/iEyxtw4HxmEsDfMAydlWkAZhNuULBC6i5HmX+YoIPD+OrbIJ3wZ9VADbYcJillI4sS6YyNuZe8ix6wH2elARgNi7Z4A8pHfUPHoN/V5Px45cF9zAvNAZxNifwbD+ClUrI6zyxuxoq5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660923786; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wicKql4I/h9UnyT0qeiWtm97WB3+4GVyQ+X7NhjeYE4=; b=mnuCsxEE3I0vGg6od4kmTTA9hIcvNES0YTA5ZatG2UJf2vEZuv0LKhdgpLwfQK/PJt7AMQah/fNroIRiLyT4Eyx4+zVLOGdhPA7dHdmihO5JrpMBgO/L7AxQ/u4fwn2yl2QzQolS56CU67aMbDc0SDamrR//fm7tNi3rEfd86hs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660923786877273.4655608937119; Fri, 19 Aug 2022 08:43:06 -0700 (PDT) Received: from localhost ([::1]:46750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP49J-0003Kx-Q7 for importer@patchew.org; Fri, 19 Aug 2022 11:43:05 -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) 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) 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-Google-Smtp-Source: AA6agR6dBct5DooPmF2wUlVZLk86l55DJfWxYUIfhvTjY5iU06dk3F2seoBbT8W1dOrB8u2hANiuqg== 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) From: Peter Maydell To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Daniel Henrique Barboza , David Gibson , Greg Kurz , Dmitry Fleytman , =?UTF-8?q?Daniel=20P=2E=20Berrang=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660923787871100001 From: Philippe Mathieu-Daud=C3=A9 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=C3=A9 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, struc= t ohci_ed *ed) return 1; } =20 +#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 =3D 16; int i; - char tmp[3 * width + 1]; + char tmp[3 * HEX_CHAR_PER_LINE + 1]; char *p =3D tmp; =20 print16 =3D !!trace_event_get_state_backends(TRACE_USB_OHCI_TD_PKT_SHO= RT); @@ -822,7 +823,7 @@ static void ohci_td_pkt(const char *msg, const uint8_t = *buf, size_t len) } =20 for (i =3D 0; ; i++) { - if (i && (!(i % width) || (i =3D=3D len))) { + if (i && (!(i % HEX_CHAR_PER_LINE) || (i =3D=3D len))) { if (!printall) { trace_usb_ohci_td_pkt_short(msg, tmp); break; --=20 2.25.1