mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 07:03:28 -04:00
clk: clocking-wizard: fix integer overflow in rate calculation
When using driver on Zynq-7000 (32-bit) determine_rate calculation
overflows. For instance requesting 32MHz with 100MHz parent clock
results in 100000000*(4*1000+0) 32-bit multiplication.
Replace the expression with mult_frac which is already used in
clk_wzrd_recalc_ratef.
Cc: stable@vger.kernel.org
Fixes: 7681f64e64 ("clk: clocking-wizard: calculate dividers fractional parts")
Signed-off-by: Pale Löbl <pavel@loebl.cz>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
This commit is contained in:
@@ -663,8 +663,8 @@ static int clk_wzrd_determine_rate_all(struct clk_hw *hw,
|
||||
d = divider->d;
|
||||
o = divider->o;
|
||||
|
||||
req->rate = div_u64(req->best_parent_rate * (m * 1000 + divider->m_frac),
|
||||
d * (o * 1000 + divider->o_frac));
|
||||
req->rate = mult_frac(req->best_parent_rate, m * 1000 + divider->m_frac,
|
||||
d * (o * 1000 + divider->o_frac));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user