From patchwork Fri Feb 2 15:16:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13543018 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDE5BC48295 for ; Fri, 2 Feb 2024 15:17:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.675078.1050262 (Exim 4.92) (envelope-from ) id 1rVvHh-0006T2-2s; Fri, 02 Feb 2024 15:16:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 675078.1050262; Fri, 02 Feb 2024 15:16:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVvHg-0006RZ-P3; Fri, 02 Feb 2024 15:16:52 +0000 Received: by outflank-mailman (input) for mailman id 675078; Fri, 02 Feb 2024 15:16:51 +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 1rVvHf-0005mR-Kl for xen-devel@lists.xenproject.org; Fri, 02 Feb 2024 15:16:51 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1681f954-c1de-11ee-98f5-efadbce2ee36; Fri, 02 Feb 2024 16:16:50 +0100 (CET) Received: from beta.station (net-188-218-67-100.cust.vodafonedsl.it [188.218.67.100]) by support.bugseng.com (Postfix) with ESMTPSA id 55B664EE073F; Fri, 2 Feb 2024 16:16:49 +0100 (CET) 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: 1681f954-c1de-11ee-98f5-efadbce2ee36 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu , Maria Celeste Cesario Subject: [XEN PATCH v4 2/4] xen/ns16550: address violations of MISRA C:2012 Rule 13.1 Date: Fri, 2 Feb 2024 16:16:03 +0100 Message-Id: <08f1d4a7475c557da016482025067f54e2e56b99.1706886631.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Rule 13.1: Initializer lists shall not contain persistent side effects The assignment operation in: .irq = rc = uart->irq, is a persistent side effect in a struct initializer list. This patch assigns rc separately outside the structure. No functional change. Signed-off-by: Simone Ballarin Signed-off-by: Maria Celeste Cesario Acked-by: Jan Beulich --- Changes in v3: - add assignment of rc; - use rc as controlling expression in the following if-statement; - change prefix from xen to xen/ns16550. Changes in v2: - avoid assignment of rc; - drop changes in vcpu_yield(void). --- xen/drivers/char/ns16550.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index afe3d514b9..97bf098534 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -441,10 +441,12 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port) struct msi_info msi = { .sbdf = PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2]), - .irq = rc = uart->irq, + .irq = uart->irq, .entry_nr = 1 }; + rc = uart->irq; + if ( rc > 0 ) { struct msi_desc *msi_desc = NULL;