mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
clk: rockchip: avoid unintentional integer overflow in rockchip_rk3588_pll_recalc_rate()
Fixes: 58c1fa2ef2 ("clk: rockchip: add pll type for RK3588")
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I840458595475e9e1bb6df74453829ea22dd2d729
This commit is contained in:
@@ -1329,6 +1329,8 @@ static unsigned long rockchip_rk3588_pll_recalc_rate(struct clk_hw *hw,
|
||||
return pll->scaling;
|
||||
|
||||
rockchip_rk3588_pll_get_params(pll, &cur);
|
||||
if (cur.p == 0)
|
||||
return prate;
|
||||
|
||||
rate64 *= cur.m;
|
||||
do_div(rate64, cur.p);
|
||||
@@ -1337,7 +1339,8 @@ static unsigned long rockchip_rk3588_pll_recalc_rate(struct clk_hw *hw,
|
||||
/* fractional mode */
|
||||
u64 frac_rate64 = prate * cur.k;
|
||||
|
||||
postdiv = cur.p * 65536;
|
||||
postdiv = cur.p;
|
||||
postdiv *= 65536;
|
||||
do_div(frac_rate64, postdiv);
|
||||
rate64 += frac_rate64;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user