summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Lindholm <leif.lindholm@oss.qualcomm.com>2025-02-12 19:05:20 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-03-19 14:18:12 +0000
commit22919e560bda6d71ce18ac6c86ef4e7716c0082d (patch)
treeba7bd31adb82c10ecb4ad4ce6d9cc2c573eb60d7
parentf6aba88ac8af6d4561a2f0f452e13564dde9d029 (diff)
downloadedk2-22919e560bda6d71ce18ac6c86ef4e7716c0082d.zip
edk2-22919e560bda6d71ce18ac6c86ef4e7716c0082d.tar.gz
edk2-22919e560bda6d71ce18ac6c86ef4e7716c0082d.tar.bz2
MdeModulePkg/VarCheckHiiLib: clean up VarCheckHiiLibReceiveHiiBinHandler
Building VarCheckHiiLib fails on my clang 19.1.6 setup with the error variable 'Status' is used uninitialized whenever 'if' condition is false due to the DispatchHandle != NULL test. Calling this function with a NULL handle makes no sense, so move the test to the function entry and return failure if appropriate. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
-rw-r--r--MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c
index 2fe8ee7..ba16116 100644
--- a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c
+++ b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c
@@ -57,7 +57,7 @@ VarCheckHiiLibReceiveHiiBinHandler (
//
// If input is invalid, stop processing this SMI
//
- if ((CommBuffer == NULL) || (CommBufferSize == NULL)) {
+ if ((DispatchHandle == NULL) || (CommBuffer == NULL) || (CommBufferSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -75,16 +75,16 @@ VarCheckHiiLibReceiveHiiBinHandler (
}
CopyMem (mMmReceivedVarCheckHiiBin, CommBuffer, mMmReceivedVarCheckHiiBinSize);
- if (DispatchHandle != NULL) {
- Status = gMmst->MmiHandlerUnRegister (DispatchHandle);
- }
+
+ Status = gMmst->MmiHandlerUnRegister (DispatchHandle);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Failed to unregister handler - %r!\n", __func__, Status));
- } else {
- DEBUG ((DEBUG_INFO, "%a: Handler unregistered successfully.\n", __func__));
+ return Status;
}
+ DEBUG ((DEBUG_INFO, "%a: Handler unregistered successfully.\n", __func__));
+
return EFI_SUCCESS;
}