[edk2-devel] [PATCH edk2-platforms 03/15] Platform,Silicon: fix beagleboard tautological compares

Leif Lindholm posted 15 patches 5 years, 2 months ago
[edk2-devel] [PATCH edk2-platforms 03/15] Platform,Silicon: fix beagleboard tautological compares
Posted by Leif Lindholm 5 years, 2 months ago
Fix two instances of masking a single bit and testing another.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
---
 .../BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c      | 2 +-
 Silicon/TexasInstruments/Omap35xxPkg/SmbusDxe/Smbus.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Platform/BeagleBoard/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c b/Platform/BeagleBoard/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
index f3e0201a6f1f..e673afda6414 100644
--- a/Platform/BeagleBoard/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/Platform/BeagleBoard/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -34,7 +34,7 @@ ResetCold (
 {
   //Perform cold reset of the system.
   MmioOr32 (PRM_RSTCTRL, RST_DPLL3);
-  while ((MmioRead32(PRM_RSTST) & GLOBAL_COLD_RST) != 0x1);
+  while (!(MmioRead32(PRM_RSTST) & GLOBAL_COLD_RST));
 }
 
 /**
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/SmbusDxe/Smbus.c b/Silicon/TexasInstruments/Omap35xxPkg/SmbusDxe/Smbus.c
index 894ba3313cdf..a8b820e84800 100644
--- a/Silicon/TexasInstruments/Omap35xxPkg/SmbusDxe/Smbus.c
+++ b/Silicon/TexasInstruments/Omap35xxPkg/SmbusDxe/Smbus.c
@@ -28,7 +28,7 @@ WaitForBusBusy (
 {
   UINTN Retry = 0;
 
-  while (++Retry < MAX_RETRY && (MmioRead16(I2C_STAT) & BB) == 0x1);
+  while (++Retry < MAX_RETRY && (MmioRead16(I2C_STAT) & BB));
 
   if (Retry == MAX_RETRY) {
     return EFI_TIMEOUT;
-- 
2.20.1



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