diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c index 12a7e6df5d..f092208a66 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c @@ -236,12 +236,7 @@ ClockDescribeRates ( *TotalRates = NUM_RATES (DescribeRates->NumRatesFlags) + NUM_REMAIN_RATES (DescribeRates->NumRatesFlags); - if (*Format == ScmiClockRateFormatDiscrete) { - RequiredArraySize = (*TotalRates) * sizeof (UINT64); - } else { - // We need to return triplet of 64 bit value for each rate - RequiredArraySize = (*TotalRates) * 3 * sizeof (UINT64); - } + RequiredArraySize = (*TotalRates) * sizeof (UINT64); if (RequiredArraySize > (*RateArraySize)) { *RateArraySize = RequiredArraySize; @@ -259,23 +254,21 @@ ClockDescribeRates ( ConvertTo64Bit (Rate->Low, Rate->High); } } else { - for (RateNo = 0; RateNo < NUM_RATES (DescribeRates->NumRatesFlags); RateNo++) { - // Linear clock rates from minimum to maximum in steps - // Minimum clock rate. - Rate = &DescribeRates->Rates[RateOffset++]; - RateArray[RateIndex].ContinuousRate.Min = - ConvertTo64Bit (Rate->Low, Rate->High); + // Linear clock rates from minimum to maximum in steps + // Minimum clock rate. + Rate = &DescribeRates->Rates[RateOffset++]; + RateArray[RateIndex].ContinuousRate.Min = + ConvertTo64Bit (Rate->Low, Rate->High); - Rate = &DescribeRates->Rates[RateOffset++]; - // Maximum clock rate. - RateArray[RateIndex].ContinuousRate.Max = - ConvertTo64Bit (Rate->Low, Rate->High); + Rate = &DescribeRates->Rates[RateOffset++]; + // Maximum clock rate. + RateArray[RateIndex].ContinuousRate.Max = + ConvertTo64Bit (Rate->Low, Rate->High); - Rate = &DescribeRates->Rates[RateOffset++]; - // Step. - RateArray[RateIndex++].ContinuousRate.Step = - ConvertTo64Bit (Rate->Low, Rate->High); - } + Rate = &DescribeRates->Rates[RateOffset++]; + // Step. + RateArray[RateIndex++].ContinuousRate.Step = + ConvertTo64Bit (Rate->Low, Rate->High); } } while (NUM_REMAIN_RATES (DescribeRates->NumRatesFlags) != 0);