From nobody Fri Dec 19 15:54:51 2025 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=1663872342; cv=none; d=zohomail.com; s=zohoarc; b=jcGMBRukrPTy3J3okc0LDOeAta9Np/hIj+2zTD3wrqxUEU/B6/5l/mD1BOWsevC4yqrI19FgWW8ktgNWgSzduETPFpRAj/jJ+QIchUPTMInrCbcPeO7lRi0dNW0gocfbXbiS4Sd2Ww5N/JWYReZHSyXPL91+j3p4x1KDDDx72Zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663872342; h=Content-Type:Content-Transfer-Encoding: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=UoIEVd6qFvT+Ln9sMhn/rS//C5+/7lw2UA59aXrFoHY=; b=iRzaiU0yV0OpszFpZuGuSYWE8qe4/rdl8sSan/lGR8S6tBz/brPspJMhSq1kn+ScDqQLCO8MFLj8fEUwUVI3iRI95SfFGzNnBaQ7UYbhYGnE916CSelKZEDhxLmE4LC3ef1vS/HAgBiBvQwnXya5D7C0tULGrL+K5Lz0BEY7lSc= 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 1663872342625310.95737710010997; Thu, 22 Sep 2022 11:45:42 -0700 (PDT) Received: from localhost ([::1]:57364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obRCf-0000Mf-Ig for importer@patchew.org; Thu, 22 Sep 2022 14:45:41 -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) 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) 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-Google-Smtp-Source: AMsMyM5E/jHh7623L0fsi52aRCWz5hUkCLOzaxpQWrfW6HAp+kGBA0JWjV4dUW46MZJqSstge/4iAw== 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) 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 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::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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1663872343922100001 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 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, 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