From nobody Sat Nov 23 18:15:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1700847059850554.6569921433428; Fri, 24 Nov 2023 09:30:59 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.640861.999617 (Exim 4.92) (envelope-from ) id 1r6a0g-0002wB-FB; Fri, 24 Nov 2023 17:30:34 +0000 Received: by outflank-mailman (output) from mailman id 640861.999617; Fri, 24 Nov 2023 17:30:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6a0g-0002vB-7a; Fri, 24 Nov 2023 17:30:34 +0000 Received: by outflank-mailman (input) for mailman id 640861; Fri, 24 Nov 2023 17:30:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r6a0e-0002YK-97 for xen-devel@lists.xenproject.org; Fri, 24 Nov 2023 17:30:32 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 29794bea-8aef-11ee-9b0e-b553b5be7939; Fri, 24 Nov 2023 18:30:29 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 9D7834EE0747; Fri, 24 Nov 2023 18:30:28 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 29794bea-8aef-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Maria Celeste Cesario Subject: [XEN PATCH v2 3/3] xen: address violations of MISRA C:2012 Rule 13.1 Date: Fri, 24 Nov 2023 18:29:43 +0100 Message-Id: <771a6f804f4e7dda3897359b57d1d14c2878ea16.1700844359.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700847061757100001 Content-Type: text/plain; charset="utf-8" Rule 13.1: Initializer lists shall not contain persistent side effects The assignment operation in: .irq =3D rc =3D uart->irq, is a persistent side effect in a struct initializer list. This patch avoids rc assignment and directly uses uart->irq in the following if statement. No functional changes. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- Changes in v2: - avoid assignment of rc; - drop changes in vcpu_yield(void). --- xen/drivers/char/ns16550.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index ddf2a48be6..644a3192bb 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -445,11 +445,13 @@ static void __init cf_check ns16550_init_postirq(stru= ct serial_port *port) struct msi_info msi =3D { .sbdf =3D PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2]), - .irq =3D rc =3D uart->irq, + .irq =3D uart->irq, .entry_nr =3D 1 }; =20 - if ( rc > 0 ) + rc =3D 0; + + if ( uart->irq > 0 ) { struct msi_desc *msi_desc =3D NULL; =20 --=20 2.34.1