Skip to content

Commit 92c550f

Browse files
Changcheng Dengandersson
Changcheng Deng
authored andcommitted
PM: AVS: qcom-cpr: Use div64_ul instead of do_div
do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation. Reported-by: Zeal Robot <[email protected]> Signed-off-by: Changcheng Deng <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6fc61c3 commit 92c550f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/soc/qcom/cpr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ static int cpr_interpolate(const struct corner *corner, int step_volt,
10101010
return corner->uV;
10111011

10121012
temp = f_diff * (uV_high - uV_low);
1013-
do_div(temp, f_high - f_low);
1013+
temp = div64_ul(temp, f_high - f_low);
10141014

10151015
/*
10161016
* max_volt_scale has units of uV/MHz while freq values

0 commit comments

Comments
 (0)