From 22919e560bda6d71ce18ac6c86ef4e7716c0082d Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Wed, 12 Feb 2025 19:05:20 +0000 Subject: 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 --- .../Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'MdeModulePkg/Library/VarCheckHiiLib') 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; } -- cgit v1.1