From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.22642.1684848756159319833 for ; Tue, 23 May 2023 06:32:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j3tWTrBP; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B66061EC5 for ; Tue, 23 May 2023 13:32:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11497C4339E for ; Tue, 23 May 2023 13:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684848755; bh=zDYq2N4jw9TueL2AvQl9wwFMmUYMjLA3T/ZzgSeVmwc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=j3tWTrBPH4MjycnfwfXbe+EWaRq+H5rTDWcy9RR6RuzDF5nT7npJay3fG+ePmcRU2 aRRnYtTfZimohKb8sJEoLAujvtGPn8Jy+wBnu1aFKpeiws4kVramamQ8CNc4yDGPh3 Qrq/azktREan00V7J4JkmD1Wfh0wUqQJ/4K6i6Bs9QJOrXWI2YLCl4+MdHKWoUpupN IYzmTu1XVEsPlD+rAKsXETel5fzUT/hTaFgFg4vgBHzJLsFAKEMUynMMyMu/huXyRQ gLgEtEdI6pUTZZZax24e8mYDd2iiHbn85iNFtheufaeCZAZRKC72am5MGrBfN9wCSy TezAiW5P7EN8w== Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2af1e290921so63146701fa.3 for ; Tue, 23 May 2023 06:32:34 -0700 (PDT) X-Gm-Message-State: AC+VfDyesCanQhxheGyL36Jwjlqo8PdV92F6i+tE3Pyckdpzm+qeANVe 2J28WKTHvi+c9MNJVy9ERUjKrAh9nriXjPy1BFw= X-Google-Smtp-Source: ACHHUZ62Wb+kyzgyzx6HxlU00ha+ZinkKcqD+5U4UasZKLOnujTsYdOQ9ETy1QNl2jUMY0CvQny3J+cEooxzpTp6upo= X-Received: by 2002:a2e:3503:0:b0:2ac:8402:2eca with SMTP id z3-20020a2e3503000000b002ac84022ecamr5277046ljz.28.1684848753019; Tue, 23 May 2023 06:32:33 -0700 (PDT) MIME-Version: 1.0 References: <20230523130421.10804-1-sami.mujawar@arm.com> <20230523130421.10804-5-sami.mujawar@arm.com> In-Reply-To: <20230523130421.10804-5-sami.mujawar@arm.com> From: "Ard Biesheuvel" Date: Tue, 23 May 2023 15:32:21 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 04/12] ArmPkg: Fix Non-Boolean comparison in ArmGicEnableDistributor To: Sami Mujawar Cc: devel@edk2.groups.io, ardb+tianocore@kernel.org, quic_llindhol@quicinc.com, neil.jones@blaize.com, pedro.falcato@gmail.com, pierre.gondois@arm.com, Matteo.Carlini@arm.com, Akanksha.Jain2@arm.com, Ben.Adderson@arm.com, Sibel.Allinson@arm.com, nd@arm.com Content-Type: text/plain; charset="UTF-8" On Tue, 23 May 2023 at 15:04, Sami Mujawar wrote: > > According to edk2 coding standard specification, Non-Boolean > comparisons must use a compare operator (==, !=, >, < >=, <=). > See Section 5.7.2.1 at https://edk2-docs.gitbook.io/ > edk-ii-c-coding-standards-specification/5_source_files/ > 57_c_programming > > Therefore, fix the comparison in ArmGicEnableDistributor() > > Signed-off-by: Sami Mujawar > --- > ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c b/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c > index c17cbe041e8a9ceb8c8c3a6b953ff88b75f6f206..1ca66a40940434d6d89e243650f3e81aa3f588b5 100644 > --- a/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c > +++ b/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c > @@ -26,7 +26,10 @@ ArmGicEnableDistributor ( > if (Revision == ARM_GIC_ARCH_REVISION_2) { > MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1); > } else { > - if (MmioRead32 (GicDistributorBase + ARM_GIC_ICDDCR) & ARM_GIC_ICDDCR_ARE) { > + if ((MmioRead32 ( > + GicDistributorBase + ARM_GIC_ICDDCR > + ) & ARM_GIC_ICDDCR_ARE) != 0) > + { This coding style is terrible. Mind using a temporary variable for the result of the MmioRead32() instead? > MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x2); > } else { > MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1); > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >