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

PierreGondois pierre.gondois at arm.com
Thu Dec 3 18:19:31 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/Library/PL011UartLib/PL011UartLib.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index f1015b1fce33a8188915b3bbeda81c2c37e35cb0..3c58a0f39acb3867048f46c25ec1d41930a2b2ee 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -2,7 +2,7 @@
   Serial I/O Port library functions with no library constructor/destructor

   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-  Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
+  Copyright (c) 2011 - 2020, Arm Limited. All rights reserved.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -269,31 +269,31 @@ PL011UartSetControl (
 {
   UINT32  Bits;

-  if (Control & (mInvalidControlBits)) {
+  if ((Control & mInvalidControlBits) != 0) {
     return RETURN_UNSUPPORTED;
   }

   Bits = MmioRead32 (UartBase + UARTCR);

-  if (Control & EFI_SERIAL_REQUEST_TO_SEND) {
+  if ((Control & EFI_SERIAL_REQUEST_TO_SEND) != 0) {
     Bits |= PL011_UARTCR_RTS;
   } else {
     Bits &= ~PL011_UARTCR_RTS;
   }

-  if (Control & EFI_SERIAL_DATA_TERMINAL_READY) {
+  if ((Control & EFI_SERIAL_DATA_TERMINAL_READY) != 0) {
     Bits |= PL011_UARTCR_DTR;
   } else {
     Bits &= ~PL011_UARTCR_DTR;
   }

-  if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) {
+  if ((Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) != 0) {
     Bits |= PL011_UARTCR_LBE;
   } else {
     Bits &= ~PL011_UARTCR_LBE;
   }

-  if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) {
+  if ((Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) != 0) {
     Bits |= (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN);
   } else {
     Bits &= ~(PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN);
--
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68265): https://edk2.groups.io/g/devel/message/68265
Mute This Topic: https://groups.io/mt/78690947/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