Skip to content

Commit 8aa6f76

Browse files
juhosgUlf Hansson
authored andcommitted
pmdomain: qcom: rpmpd: fix off-by-one error in clamping to the highest state
As it is indicated by the comment, the rpmpd_aggregate_corner() function tries to clamp the state to the highest corner/level supported by the given power domain, however the calculation of the highest state contains an off-by-one error. The 'max_state' member of the 'rpmpd' structure indicates the highest corner/level, and as such it does not needs to be decremented. Change the code to use the 'max_state' value directly to avoid the error. Fixes: 98c8b3e ("soc: qcom: rpmpd: Add sync_state") Signed-off-by: Gabor Juhos <j4g8y7@gmail.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 861d21c commit 8aa6f76

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/pmdomain/qcom/rpmpd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ static int rpmpd_aggregate_corner(struct rpmpd *pd)
10011001

10021002
/* Clamp to the highest corner/level if sync_state isn't done yet */
10031003
if (!pd->state_synced)
1004-
this_active_corner = this_sleep_corner = pd->max_state - 1;
1004+
this_active_corner = this_sleep_corner = pd->max_state;
10051005
else
10061006
to_active_sleep(pd, pd->corner, &this_active_corner, &this_sleep_corner);
10071007

0 commit comments

Comments
 (0)