Skip to content
Commit f7b7d301 authored by Devi Priya's avatar Devi Priya Committed by Bjorn Andersson
Browse files

clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies



If the parent clock rate is greater than unsigned long max/2 then
integer overflow happens when calculating the clock rate on 32-bit systems.
As RCG2 uses half integer dividers, the clock rate is first being
multiplied by 2 which will overflow the unsigned long max value.
Hence, replace the common pattern of doing 64-bit multiplication
and then a do_div() call with simpler mult_frac call.

Fixes: bcd61c0f ("clk: qcom: Add support for root clock generators (RCGs)")
Signed-off-by: default avatarDevi Priya <quic_devipriy@quicinc.com>
Reviewed-by: default avatarMarijn Suijten <marijn.suijten@somainline.org>
Link: https://lore.kernel.org/r/20230901073640.4973-1-quic_devipriy@quicinc.com


[bjorn: Also drop unnecessary {} around single statements]
Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 4afda5f6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment