Skip to content

Commit 22919e5

Browse files
leiflindholmmergify[bot]
authored andcommitted
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 <[email protected]>
1 parent f6aba88 commit 22919e5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ VarCheckHiiLibReceiveHiiBinHandler (
5757
//
5858
// If input is invalid, stop processing this SMI
5959
//
60-
if ((CommBuffer == NULL) || (CommBufferSize == NULL)) {
60+
if ((DispatchHandle == NULL) || (CommBuffer == NULL) || (CommBufferSize == NULL)) {
6161
return EFI_INVALID_PARAMETER;
6262
}
6363

@@ -75,16 +75,16 @@ VarCheckHiiLibReceiveHiiBinHandler (
7575
}
7676

7777
CopyMem (mMmReceivedVarCheckHiiBin, CommBuffer, mMmReceivedVarCheckHiiBinSize);
78-
if (DispatchHandle != NULL) {
79-
Status = gMmst->MmiHandlerUnRegister (DispatchHandle);
80-
}
78+
79+
Status = gMmst->MmiHandlerUnRegister (DispatchHandle);
8180

8281
if (EFI_ERROR (Status)) {
8382
DEBUG ((DEBUG_ERROR, "%a: Failed to unregister handler - %r!\n", __func__, Status));
84-
} else {
85-
DEBUG ((DEBUG_INFO, "%a: Handler unregistered successfully.\n", __func__));
83+
return Status;
8684
}
8785

86+
DEBUG ((DEBUG_INFO, "%a: Handler unregistered successfully.\n", __func__));
87+
8888
return EFI_SUCCESS;
8989
}
9090

0 commit comments

Comments
 (0)