From patchwork Tue Jun 20 10:35:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13285635 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 3F380EB64D7 for ; Tue, 20 Jun 2023 11:01:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.551551.861200 (Exim 4.92) (envelope-from ) id 1qBZ75-0000op-2I; Tue, 20 Jun 2023 11:01:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 551551.861200; Tue, 20 Jun 2023 11:01:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBZ74-0000mI-En; Tue, 20 Jun 2023 11:01:30 +0000 Received: by outflank-mailman (input) for mailman id 551551; Tue, 20 Jun 2023 10:35:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBYhx-0004Pq-7R for xen-devel@lists.xenproject.org; Tue, 20 Jun 2023 10:35:33 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2ef2b969-0f56-11ee-b234-6b7b168915f2; Tue, 20 Jun 2023 12:35:32 +0200 (CEST) Received: from beta.bugseng.com (93-40-74-174.ip37.fastwebnet.it [93.40.74.174]) by support.bugseng.com (Postfix) with ESMTPSA id DC6234EE0752; Tue, 20 Jun 2023 12:35:30 +0200 (CEST) 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: 2ef2b969-0f56-11ee-b234-6b7b168915f2 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Gianluca Luparini , Jan Beulich , Paul Durrant , =?utf-8?q?Rog?= =?utf-8?q?er_Pau_Monn=C3=A9?= , Stefano Stabellini , Michal Orzel , Xenia Ragiadakou , Ayan Kumar , Simone Ballarin Subject: [XEN PATCH 08/13] xen/pci: fixed violations of MISRA C:2012 Rule 7.2 Date: Tue, 20 Jun 2023 12:35:00 +0200 Message-Id: <3d1a98c8070d4e502402356dd65153dcc813edef.1687250177.git.gianluca.luparini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Gianluca Luparini The xen sources contains violations of MISRA C:2012 Rule 7.2 whose headline states: "A "u" or "U" suffix shall be applied to all integer constants that are represented in an unsigned type". I propose to use "U" as a suffix to explicitly state when an integer constant is represented in an unsigned type. For homogeneity, I also added the "U" suffix in some cases that the tool didn't report as violations. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/drivers/passthrough/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 07d1986d33..95846e84f2 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -990,8 +990,8 @@ bool_t __init pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func) vendor = pci_conf_read32(PCI_SBDF(seg, bus, dev, func), PCI_VENDOR_ID); /* some broken boards return 0 or ~0 if a slot is empty: */ - if ( (vendor == 0xffffffff) || (vendor == 0x00000000) || - (vendor == 0x0000ffff) || (vendor == 0xffff0000) ) + if ( (vendor == 0xffffffffU) || (vendor == 0x00000000U) || + (vendor == 0x0000ffffU) || (vendor == 0xffff0000U) ) return 0; return 1; }