Properly set return values for Dump Debug command in error scenarios
In certain error scenario the dump debug command returns success. One such
scenario is when the destination argument is invalid. This change detects
such scenarios and sets the correct return values.
@@ -174,7 +174,9 @@ DumpDebugCommand(
if (!dictExists)
{
+ ReturnCode = EFI_LOAD_ERROR;
PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"The passed dictionary file doesn't exist\n");
+ goto Finish;
}
}
@@ -184,6 +186,7 @@ DumpDebugCommand(
dict_head = load_nlog_dict(pCmd, pDictUserPath, &dict_version, &dict_entries);
if (!dict_head)
{
+ ReturnCode = EFI_LOAD_ERROR;
PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"Failed to load the dictionary file " FORMAT_STR L"\n", pDictUserPath);
goto Finish;
}
@@ -285,7 +288,16 @@ FreeAndContinue:
FreeCommandStatus(&pCommandStatus);
}
}
-
+ // Return success if any of 3 logs were retrieved on every specified dimm
+ ReturnCode = EFI_SUCCESS;
+ for (Index = 0; Index < DimmCount; Index++)
+ {
+ if (SuccessesPerDimm[Index] == 0)
+ {
+ // If any specified dimm (initialized with 0) had no successes, then return error
+ ReturnCode = EFI_DEVICE_ERROR;
+ }
+ }
Finish:
PRINTER_PROCESS_SET_BUFFER(pPrinterCtx);
@@ -304,17 +316,6 @@ Finish:
FREE_POOL_SAFE(pDictUserPath);
FREE_POOL_SAFE(pDumpUserPath);
- // Return success if any of 3 logs were retrieved on every specified dimm
- ReturnCode = EFI_SUCCESS;
- for (Index = 0; Index < DimmCount; Index++)
- {
- if (SuccessesPerDimm[Index] == 0)
- {
- // If any specified dimm (initialized with 0) had no successes, then return error
- ReturnCode = EFI_DEVICE_ERROR;
- }
- }
-
NVDIMM_EXIT_I64(ReturnCode);
return ReturnCode;
}
