diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index aa9c2cdf7a..fe85937f55 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -392,7 +392,7 @@ BuildCachedGuidHandleTable ( FreePool (HandleBuffer); HandleBuffer = NULL; } - return Status; + return EFI_SUCCESS; } /** @@ -731,35 +731,6 @@ RunDp ( Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); - // - // DP dump performance data by parsing FPDT table in ACPI table. - // Folloing 3 steps are to get the measurement form the FPDT table. - // - - // - //1. Get FPDT from ACPI table. - // - Status = GetBootPerformanceTable (); - if (EFI_ERROR(Status)) { - return Status; - } - - // - //2. Cache the ModuleGuid and hanlde mapping table. - // - Status = BuildCachedGuidHandleTable(); - if (EFI_ERROR (Status)) { - return Status; - } - - // - //3. Build the measurement array form the FPDT records. - // - Status = BuildMeasurementList (); - if (EFI_ERROR(Status)) { - return Status; - } - // // Process Command Line arguments // @@ -811,6 +782,38 @@ RunDp ( #endif // PROFILING_IMPLEMENTED } + // + // DP dump performance data by parsing FPDT table in ACPI table. + // Folloing 3 steps are to get the measurement form the FPDT table. + // + + // + //1. Get FPDT from ACPI table. + // + Status = GetBootPerformanceTable (); + if (EFI_ERROR (Status)) { + ShellStatus = Status; + goto Done; + } + + // + //2. Cache the ModuleGuid and hanlde mapping table. + // + Status = BuildCachedGuidHandleTable(); + if (EFI_ERROR (Status)) { + ShellStatus = Status; + goto Done; + } + + // + //3. Build the measurement array form the FPDT records. + // + Status = BuildMeasurementList (); + if (EFI_ERROR (Status)) { + ShellStatus = SHELL_OUT_OF_RESOURCES; + goto Done; + } + // // Initialize the pre-defined cumulative data. // @@ -823,7 +826,8 @@ RunDp ( if (CustomCumulativeToken != NULL) { CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA)); if (CustomCumulativeData == NULL) { - return SHELL_OUT_OF_RESOURCES; + ShellStatus = SHELL_OUT_OF_RESOURCES; + goto Done; } CustomCumulativeData->MinDur = PERF_MAXDUR; CustomCumulativeData->MaxDur = 0; @@ -832,8 +836,8 @@ RunDp ( NameSize = StrLen (CustomCumulativeToken) + 1; CustomCumulativeData->Name = AllocateZeroPool (NameSize); if (CustomCumulativeData->Name == NULL) { - FreePool (CustomCumulativeData); - return SHELL_OUT_OF_RESOURCES; + ShellStatus = SHELL_OUT_OF_RESOURCES; + goto Done; } UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize); }