public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report
@ 2023-09-06  2:19 Huang, Yanbo
  2023-09-19 20:04 ` Nate DeSimone
  2023-09-19 20:07 ` Nate DeSimone
  0 siblings, 2 replies; 4+ messages in thread
From: Huang, Yanbo @ 2023-09-06  2:19 UTC (permalink / raw)
  To: devel; +Cc: Yanbo Huang, Isaac Oram, Nate DeSimone, Liming Gao

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4522

"if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {" will not be executed in current code,
put it within "case SysInterfaceKcs:" to avoid this issue.

Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Yanbo Huang <yanbo.huang@intel.com>
---
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 36 ++++++++----------
 .../GenericIpmi/Pei/PeiGenericIpmi.c          | 36 ++++++++----------
 .../GenericIpmi/Smm/SmmGenericIpmi.c          | 38 +++++++++----------
 3 files changed, 49 insertions(+), 61 deletions(-)

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
index 7113556df8..82f6d2a661 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
@@ -630,8 +630,8 @@ InitializeIpmiKcsPhysicalLayer (
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized;
@@ -646,21 +646,19 @@ InitializeIpmiKcsPhysicalLayer (
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
@@ -669,12 +667,11 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid
                                                     );
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
@@ -683,9 +680,8 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid
                                                     );
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
index 1d8266a0b1..ebc9e7085d 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
@@ -343,8 +343,8 @@ PeiInitializeIpmiKcsPhysicalLayer (
   // Check interface data initialized successfully else register notify protocol.
   for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
     switch (Index) {
-    if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-        case SysInterfaceKcs:
+      case SysInterfaceKcs:
+        if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
           if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
             BMC_INTERFACE_STATUS  BmcStatus;
             mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitialized;
@@ -359,42 +359,38 @@ PeiInitializeIpmiKcsPhysicalLayer (
               mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitError;
             }
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-        case SysInterfaceBt:
+      case SysInterfaceBt:
+        if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-        case SysInterfaceSsif:
+      case SysInterfaceSsif:
+        if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.SsifInterfaceApiGuid);
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-        case SysInterfaceIpmb:
+      case SysInterfaceIpmb:
+        if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.IpmbInterfaceApiGuid);
           }
-
-          break;
-    }
+        }
+        break;
 
       default:
         break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
index 350d6afef5..2349373317 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
@@ -210,7 +210,7 @@ SmmNotifyCallback (
                                                  &mIpmiInstance->IpmiTransport2
                                                  );
   }
-
+  ASSERT_EFI_ERROR (Status);
   return EFI_SUCCESS;
 }
 
@@ -335,8 +335,8 @@ Returns:
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized;
@@ -351,42 +351,38 @@ Returns:
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid);
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid);
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108296): https://edk2.groups.io/g/devel/message/108296
Mute This Topic: https://groups.io/mt/101185487/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report
       [not found] <17822DD0A7D23F61.30276@groups.io>
@ 2023-09-11  2:29 ` Huang, Yanbo
  0 siblings, 0 replies; 4+ messages in thread
From: Huang, Yanbo @ 2023-09-11  2:29 UTC (permalink / raw)
  To: devel@edk2.groups.io, Huang, Yanbo, Gao, Liming
  Cc: Isaac Oram, Desimone, Nathaniel L

@Gao, Liming Could you please help to review it? 

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Huang, Yanbo
Sent: Wednesday, September 6, 2023 10:19 AM
To: devel@edk2.groups.io
Cc: Huang, Yanbo <yanbo.huang@intel.com>; Isaac Oram <isaac.w.oram@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
Subject: [edk2-devel] [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4522

"if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {" will not be executed in current code, put it within "case SysInterfaceKcs:" to avoid this issue.

Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Yanbo Huang <yanbo.huang@intel.com>
---
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 36 ++++++++----------
 .../GenericIpmi/Pei/PeiGenericIpmi.c          | 36 ++++++++----------
 .../GenericIpmi/Smm/SmmGenericIpmi.c          | 38 +++++++++----------
 3 files changed, 49 insertions(+), 61 deletions(-)

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
index 7113556df8..82f6d2a661 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/
+++ IpmiInit.c
@@ -630,8 +630,8 @@ InitializeIpmiKcsPhysicalLayer (
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -646,21 +646,19 @@ InitializeIpmiKcsPhysicalLayer (
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) { @@ -669,12 +667,11 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid
                                                     );
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) { @@ -683,9 +680,8 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid
                                                     );
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
index 1d8266a0b1..ebc9e7085d 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/
+++ PeiGenericIpmi.c
@@ -343,8 +343,8 @@ PeiInitializeIpmiKcsPhysicalLayer (
   // Check interface data initialized successfully else register notify protocol.
   for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
     switch (Index) {
-    if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-        case SysInterfaceKcs:
+      case SysInterfaceKcs:
+        if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
           if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
             BMC_INTERFACE_STATUS  BmcStatus;
             mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -359,42 +359,38 @@ PeiInitializeIpmiKcsPhysicalLayer (
               mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitError;
             }
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-        case SysInterfaceBt:
+      case SysInterfaceBt:
+        if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-        case SysInterfaceSsif:
+      case SysInterfaceSsif:
+        if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.SsifInterfaceApiGuid);
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-        case SysInterfaceIpmb:
+      case SysInterfaceIpmb:
+        if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.IpmbInterfaceApiGuid);
           }
-
-          break;
-    }
+        }
+        break;
 
       default:
         break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
index 350d6afef5..2349373317 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/
+++ SmmGenericIpmi.c
@@ -210,7 +210,7 @@ SmmNotifyCallback (
                                                  &mIpmiInstance->IpmiTransport2
                                                  );
   }
-
+  ASSERT_EFI_ERROR (Status);
   return EFI_SUCCESS;
 }
 
@@ -335,8 +335,8 @@ Returns:
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -351,42 +351,38 @@ Returns:
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid);
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid);
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
--
2.31.1.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108472): https://edk2.groups.io/g/devel/message/108472
Mute This Topic: https://groups.io/mt/101185487/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report
  2023-09-06  2:19 Huang, Yanbo
@ 2023-09-19 20:04 ` Nate DeSimone
  2023-09-19 20:07 ` Nate DeSimone
  1 sibling, 0 replies; 4+ messages in thread
From: Nate DeSimone @ 2023-09-19 20:04 UTC (permalink / raw)
  To: Huang, Yanbo, devel@edk2.groups.io; +Cc: Isaac Oram, Gao, Liming

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

-----Original Message-----
From: Huang, Yanbo <yanbo.huang@intel.com> 
Sent: Tuesday, September 5, 2023 7:19 PM
To: devel@edk2.groups.io
Cc: Huang, Yanbo <yanbo.huang@intel.com>; Isaac Oram <isaac.w.oram@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
Subject: [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4522

"if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {" will not be executed in current code, put it within "case SysInterfaceKcs:" to avoid this issue.

Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Yanbo Huang <yanbo.huang@intel.com>
---
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 36 ++++++++----------
 .../GenericIpmi/Pei/PeiGenericIpmi.c          | 36 ++++++++----------
 .../GenericIpmi/Smm/SmmGenericIpmi.c          | 38 +++++++++----------
 3 files changed, 49 insertions(+), 61 deletions(-)

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
index 7113556df8..82f6d2a661 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/
+++ IpmiInit.c
@@ -630,8 +630,8 @@ InitializeIpmiKcsPhysicalLayer (
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -646,21 +646,19 @@ InitializeIpmiKcsPhysicalLayer (
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) { @@ -669,12 +667,11 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid
                                                     );
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) { @@ -683,9 +680,8 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid
                                                     );
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
index 1d8266a0b1..ebc9e7085d 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/
+++ PeiGenericIpmi.c
@@ -343,8 +343,8 @@ PeiInitializeIpmiKcsPhysicalLayer (
   // Check interface data initialized successfully else register notify protocol.
   for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
     switch (Index) {
-    if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-        case SysInterfaceKcs:
+      case SysInterfaceKcs:
+        if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
           if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
             BMC_INTERFACE_STATUS  BmcStatus;
             mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -359,42 +359,38 @@ PeiInitializeIpmiKcsPhysicalLayer (
               mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitError;
             }
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-        case SysInterfaceBt:
+      case SysInterfaceBt:
+        if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-        case SysInterfaceSsif:
+      case SysInterfaceSsif:
+        if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.SsifInterfaceApiGuid);
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-        case SysInterfaceIpmb:
+      case SysInterfaceIpmb:
+        if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.IpmbInterfaceApiGuid);
           }
-
-          break;
-    }
+        }
+        break;
 
       default:
         break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
index 350d6afef5..2349373317 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/
+++ SmmGenericIpmi.c
@@ -210,7 +210,7 @@ SmmNotifyCallback (
                                                  &mIpmiInstance->IpmiTransport2
                                                  );
   }
-
+  ASSERT_EFI_ERROR (Status);
   return EFI_SUCCESS;
 }
 
@@ -335,8 +335,8 @@ Returns:
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -351,42 +351,38 @@ Returns:
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid);
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid);
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108857): https://edk2.groups.io/g/devel/message/108857
Mute This Topic: https://groups.io/mt/101185487/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report
  2023-09-06  2:19 Huang, Yanbo
  2023-09-19 20:04 ` Nate DeSimone
@ 2023-09-19 20:07 ` Nate DeSimone
  1 sibling, 0 replies; 4+ messages in thread
From: Nate DeSimone @ 2023-09-19 20:07 UTC (permalink / raw)
  To: Huang, Yanbo, devel@edk2.groups.io; +Cc: Isaac Oram, Gao, Liming

Pushed: https://github.com/tianocore/edk2-platforms/commit/cf8a716

-----Original Message-----
From: Huang, Yanbo <yanbo.huang@intel.com> 
Sent: Tuesday, September 5, 2023 7:19 PM
To: devel@edk2.groups.io
Cc: Huang, Yanbo <yanbo.huang@intel.com>; Isaac Oram <isaac.w.oram@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
Subject: [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4522

"if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {" will not be executed in current code, put it within "case SysInterfaceKcs:" to avoid this issue.

Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Yanbo Huang <yanbo.huang@intel.com>
---
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 36 ++++++++----------
 .../GenericIpmi/Pei/PeiGenericIpmi.c          | 36 ++++++++----------
 .../GenericIpmi/Smm/SmmGenericIpmi.c          | 38 +++++++++----------
 3 files changed, 49 insertions(+), 61 deletions(-)

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
index 7113556df8..82f6d2a661 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/
+++ IpmiInit.c
@@ -630,8 +630,8 @@ InitializeIpmiKcsPhysicalLayer (
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -646,21 +646,19 @@ InitializeIpmiKcsPhysicalLayer (
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) { @@ -669,12 +667,11 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid
                                                     );
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) { @@ -683,9 +680,8 @@ InitializeIpmiKcsPhysicalLayer (
                                                     &mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid
                                                     );
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
index 1d8266a0b1..ebc9e7085d 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/
+++ PeiGenericIpmi.c
@@ -343,8 +343,8 @@ PeiInitializeIpmiKcsPhysicalLayer (
   // Check interface data initialized successfully else register notify protocol.
   for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
     switch (Index) {
-    if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-        case SysInterfaceKcs:
+      case SysInterfaceKcs:
+        if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
           if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
             BMC_INTERFACE_STATUS  BmcStatus;
             mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -359,42 +359,38 @@ PeiInitializeIpmiKcsPhysicalLayer (
               mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitError;
             }
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-        case SysInterfaceBt:
+      case SysInterfaceBt:
+        if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-        case SysInterfaceSsif:
+      case SysInterfaceSsif:
+        if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.SsifInterfaceApiGuid);
           }
+        }
+        break;
 
-          break;
-    }
-
-    if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-        case SysInterfaceIpmb:
+      case SysInterfaceIpmb:
+        if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
           if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
             InterfaceState = IpmiInterfaceInitialized;
           } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
             // Register protocol notify for SMBUS Protocol.
             Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.IpmbInterfaceApiGuid);
           }
-
-          break;
-    }
+        }
+        break;
 
       default:
         break;
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
index 350d6afef5..2349373317 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/
+++ SmmGenericIpmi.c
@@ -210,7 +210,7 @@ SmmNotifyCallback (
                                                  &mIpmiInstance->IpmiTransport2
                                                  );
   }
-
+  ASSERT_EFI_ERROR (Status);
   return EFI_SUCCESS;
 }
 
@@ -335,8 +335,8 @@ Returns:
     // Check interface data initialized successfully else register notify protocol.
     for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
       switch (Index) {
-      if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
-          case SysInterfaceKcs:
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
             if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
               BMC_INTERFACE_STATUS  BmcStatus;
               mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -351,42 +351,38 @@ Returns:
                 mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError;
               }
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
-          case SysInterfaceBt:
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
-          case SysInterfaceSsif:
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid);
             }
+          }
+          break;
 
-            break;
-      }
-
-      if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
-          case SysInterfaceIpmb:
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
             if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) {
               InterfaceState = IpmiInterfaceInitialized;
             } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) {
               // Register protocol notify for SMBUS Protocol.
               Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid);
             }
-
-            break;
-      }
+          }
+          break;
 
         default:
           break;
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108858): https://edk2.groups.io/g/devel/message/108858
Mute This Topic: https://groups.io/mt/101185487/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-19 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <17822DD0A7D23F61.30276@groups.io>
2023-09-11  2:29 ` [edk2-devel] [PATCH v2] IpmiFeaturePkg: Refine code to avoid warning report Huang, Yanbo
2023-09-06  2:19 Huang, Yanbo
2023-09-19 20:04 ` Nate DeSimone
2023-09-19 20:07 ` Nate DeSimone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox