[edk2-devel] [edk2-platforms] [PATCH v4] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error

Vijayenthiran Subramaniam posted 1 patch 3 years, 4 months ago
Failed in applying to current master (apply log)
Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[edk2-devel] [edk2-platforms] [PATCH v4] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Vijayenthiran Subramaniam 3 years, 4 months ago
Fix "use of logical '&&' with constant operand" error when built with
clang.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---

Changes since v3:
  - Update commit message.
  - Remove comparing boolean expression with TRUE.
  - v3 discussion: https://edk2.groups.io/g/devel/topic/78500293

Changes since v2:
  - Reviewed-by added from:
    https://edk2.groups.io/g/devel/topic/71391950#55868
  - Rebased to latest master and repost.

Changes since v1:
  - Fix Copyright year

Note:
    Fix Clang build error reported by Leif in
    https://edk2.groups.io/g/devel/message/54586

 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
index 9e5f7e70..5cf8f6a7 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2018, ARM Ltd. All rights reserved.<BR>
+  Copyright (c) 2018-2020, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -82,7 +82,7 @@ InitVirtioDevices (
 
   // Install protocol interface for storage device
   if ((FeaturePcdGet (PcdVirtioBlkSupported)) &&
-      (FixedPcdGet32 (PcdVirtioBlkBaseAddress))) {
+      (FixedPcdGet32 (PcdVirtioBlkBaseAddress) != 0)) {
     Status = gBS->InstallProtocolInterface (&mVirtIoBlkController,
                     &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
                     &mVirtioBlockDevicePath);
@@ -111,7 +111,7 @@ InitVirtioDevices (
 
   // Install protocol interface for network device
   if ((FeaturePcdGet (PcdVirtioNetSupported)) &&
-      (FixedPcdGet32 (PcdVirtioNetBaseAddress))) {
+      (FixedPcdGet32 (PcdVirtioNetBaseAddress) != 0)) {
     Status = gBS->InstallProtocolInterface (&mVirtIoNetController,
                     &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
                     &mVirtioNetDevicePath);
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68050): https://edk2.groups.io/g/devel/message/68050
Mute This Topic: https://groups.io/mt/78547981/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-platforms] [PATCH v4] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Ard Biesheuvel 3 years, 4 months ago
On 11/27/20 3:39 PM, Vijayenthiran Subramaniam wrote:
> Fix "use of logical '&&' with constant operand" error when built with
> clang.
> 
> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
> ---
> 
> Changes since v3:
>    - Update commit message.
>    - Remove comparing boolean expression with TRUE.
>    - v3 discussion: https://edk2.groups.io/g/devel/topic/78500293
> 
> Changes since v2:
>    - Reviewed-by added from:
>      https://edk2.groups.io/g/devel/topic/71391950#55868
>    - Rebased to latest master and repost.
> 
> Changes since v1:
>    - Fix Copyright year
> 
> Note:
>      Fix Clang build error reported by Leif in
>      https://edk2.groups.io/g/devel/message/54586
> 
>   Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>

Pushed as f182372f928f..3f71a8fb114a

Thanks!


> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
> index 9e5f7e70..5cf8f6a7 100644
> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
> @@ -1,6 +1,6 @@
>   /** @file
>   
> -  Copyright (c) 2018, ARM Ltd. All rights reserved.<BR>
> +  Copyright (c) 2018-2020, Arm Limited. All rights reserved.
>   
>     SPDX-License-Identifier: BSD-2-Clause-Patent
>   
> @@ -82,7 +82,7 @@ InitVirtioDevices (
>   
>     // Install protocol interface for storage device
>     if ((FeaturePcdGet (PcdVirtioBlkSupported)) &&
> -      (FixedPcdGet32 (PcdVirtioBlkBaseAddress))) {
> +      (FixedPcdGet32 (PcdVirtioBlkBaseAddress) != 0)) {
>       Status = gBS->InstallProtocolInterface (&mVirtIoBlkController,
>                       &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
>                       &mVirtioBlockDevicePath);
> @@ -111,7 +111,7 @@ InitVirtioDevices (
>   
>     // Install protocol interface for network device
>     if ((FeaturePcdGet (PcdVirtioNetSupported)) &&
> -      (FixedPcdGet32 (PcdVirtioNetBaseAddress))) {
> +      (FixedPcdGet32 (PcdVirtioNetBaseAddress) != 0)) {
>       Status = gBS->InstallProtocolInterface (&mVirtIoNetController,
>                       &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
>                       &mVirtioNetDevicePath);
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68052): https://edk2.groups.io/g/devel/message/68052
Mute This Topic: https://groups.io/mt/78547981/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-