Initialize CmdStatus before trying to access it on failure
@@ -100,6 +100,14 @@ Load (
goto Finish;
}
+ // initialize status structure
+ ReturnCode = InitializeCommandStatus(&pCommandStatus);
+ if (EFI_ERROR(ReturnCode)) {
+ Print(FORMAT_STR_NL, CLI_ERR_INTERNAL_ERROR);
+ NVDIMM_DBG("Failed on InitializeCommandStatus");
+ goto Finish;
+ }
+
ReturnCode = OpenNvmDimmProtocol(gNvmDimmConfigProtocolGuid, (VOID **)&pNvmDimmConfigProtocol, NULL);
if (EFI_ERROR(ReturnCode)) {
Print(FORMAT_STR_NL, CLI_ERR_NO_CONFIG_PROTOCOL);
@@ -141,14 +149,6 @@ Load (
}
}
- // initialize status structure
- ReturnCode = InitializeCommandStatus(&pCommandStatus);
- if (EFI_ERROR(ReturnCode)) {
- Print(FORMAT_STR_NL, CLI_ERR_INTERNAL_ERROR);
- NVDIMM_DBG("Failed on InitializeCommandStatus");
- goto Finish;
- }
-
// check options
pFileName = getOptionValue(pCmd, SOURCE_OPTION);
if (pFileName == NULL) {
