]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Fix Ecc error 3002 in SemihostFs
authorPierre Gondois <Pierre.Gondois@arm.com>
Thu, 10 Dec 2020 10:38:26 +0000 (10:38 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 6 Jan 2021 16:22:54 +0000 (16:22 +0000)
This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c

index a66bcb136918ac817b52f8ba391323c5dcdd10fb..69e983226ba7e713e57c7a1b89f61565153a7256 100644 (file)
@@ -2,7 +2,7 @@
   Support a Semi Host file system over a debuggers JTAG\r
 \r
   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-  Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>\r
+  Portions copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -196,8 +196,8 @@ FileOpen (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if ((OpenMode & EFI_FILE_MODE_CREATE) &&\r
-      (Attributes & EFI_FILE_DIRECTORY)    ) {\r
+  if (((OpenMode & EFI_FILE_MODE_CREATE) != 0) &&\r
+      ((Attributes & EFI_FILE_DIRECTORY) != 0)) {\r
     return EFI_WRITE_PROTECTED;\r
   }\r
 \r
@@ -234,7 +234,7 @@ FileOpen (
   Return = SemihostFileOpen (AsciiFileName, SemihostMode, &SemihostHandle);\r
 \r
   if (RETURN_ERROR (Return)) {\r
-    if (OpenMode & EFI_FILE_MODE_CREATE) {\r
+    if ((OpenMode & EFI_FILE_MODE_CREATE) != 0) {\r
       //\r
       // In the create if does not exist case, if the opening in update\r
       // mode failed, create it and open it in update mode. The update\r
@@ -277,7 +277,8 @@ FileOpen (
 \r
   FileFcb->Info.FileSize     = Length;\r
   FileFcb->Info.PhysicalSize = Length;\r
-  FileFcb->Info.Attribute    = (OpenMode & EFI_FILE_MODE_CREATE) ? Attributes : 0;\r
+  FileFcb->Info.Attribute    = ((OpenMode & EFI_FILE_MODE_CREATE) != 0) ?\r
+                                 Attributes : 0;\r
 \r
   InsertTailList (&gFileList, &FileFcb->Link);\r
 \r