[edk2-devel] [PATCH v1 03/16] ArmPlatformPkg: Fix Ecc error 3002 in PL061GpioDxe

PierreGondois pierre.gondois at arm.com
Thu Dec 3 18:19:32 UTC 2020


From: Pierre Gondois <Pierre.Gondois at arm.com>

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois at arm.com>
---
 The changes can be seen at: https://github.com/PierreARM/edk2-platforms/tree/1537_Ecc_ArmPlatformPkg_v1

 ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
index 778bd6858f41f972734b0ea57058c18a053e4338..020d8c9fd92a38783305680980cc9159345e380e 100644
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
+++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2011, ARM Limited. All rights reserved.
+*  Copyright (c) 2011 - 2020, Arm Limited. All rights reserved.<BR>
 *  Copyright (c) 2016, Linaro Limited. All rights reserved.
 *
 *  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -181,7 +181,7 @@ Get (
     return EFI_INVALID_PARAMETER;
   }

-  if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
+  if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset)) != 0) {
     *Value = 1;
   } else {
     *Value = 0;
@@ -292,7 +292,7 @@ GetMode (
   // Check if it is input or output
   if (MmioRead8 (RegisterBase + PL061_GPIO_DIR_REG) & GPIO_PIN_MASK(Offset)) {
     // Pin set to output
-    if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
+    if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset)) != 0) {
       *Mode = GPIO_MODE_OUTPUT_1;
     } else {
       *Mode = GPIO_MODE_OUTPUT_0;
--
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68266): https://edk2.groups.io/g/devel/message/68266
Mute This Topic: https://groups.io/mt/78690949/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list