[edk2-devel] [PATCH v1 08/25] ArmPkg: Fix Ecc error 3002 in SemihostFs

PierreGondois pierre.gondois at arm.com
Wed Dec 16 17:21:43 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/commits/1552_Ecc_ArmPkg_v1

 ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
index a66bcb136918..3b07d979182f 100644
--- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
+++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
@@ -2,7 +2,7 @@
   Support a Semi Host file system over a debuggers JTAG

   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-  Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
+  Portions copyright (c) 2011 - 2020, Arm Limited. All rights reserved.<BR>

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

@@ -196,8 +196,8 @@ FileOpen (
     return EFI_INVALID_PARAMETER;
   }

-  if ((OpenMode & EFI_FILE_MODE_CREATE) &&
-      (Attributes & EFI_FILE_DIRECTORY)    ) {
+  if (((OpenMode & EFI_FILE_MODE_CREATE) != 0) &&
+      ((Attributes & EFI_FILE_DIRECTORY) != 0)) {
     return EFI_WRITE_PROTECTED;
   }

@@ -234,7 +234,7 @@ FileOpen (
   Return = SemihostFileOpen (AsciiFileName, SemihostMode, &SemihostHandle);

   if (RETURN_ERROR (Return)) {
-    if (OpenMode & EFI_FILE_MODE_CREATE) {
+    if ((OpenMode & EFI_FILE_MODE_CREATE) != 0) {
       //
       // In the create if does not exist case, if the opening in update
       // mode failed, create it and open it in update mode. The update
@@ -277,7 +277,8 @@ FileOpen (

   FileFcb->Info.FileSize     = Length;
   FileFcb->Info.PhysicalSize = Length;
-  FileFcb->Info.Attribute    = (OpenMode & EFI_FILE_MODE_CREATE) ? Attributes : 0;
+  FileFcb->Info.Attribute    = ((OpenMode & EFI_FILE_MODE_CREATE) != 0) ?
+                                 Attributes : 0;

   InsertTailList (&gFileList, &FileFcb->Link);

--
2.17.1



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