clk: axi-clkgen: Remove sometimes impossible check
PATCH 1/1 clk: axi-clkgen: Remove sometimes impossible check
The size of unsigned long on 64-bit architectures is equal to the size of u64, so this check is impossible there. This throws off static checkers:
drivers/clk/clk-axi-clkgen.c:331 axi_clkgen_recalc_rate() warn:
impossible condition '(tmp > (~0)) => (0-u64max > u64max)'
Let's change this code to use min_t() instead so that we get the same effect on architectures where sizeof(unsigned long) doesn't equal sizeof(u64).
--- drivers/clk/clk-axi-clkgen.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clk/clk-axi-clkgen.c +1 -4
@@ -328,10 +328,7 @@ static unsigned long axi_clkgen_recalc_rate(struct clk_hw *clk_hw, tmp = (unsigned long long )(parent_rate / d) * m;do_div (tmp, dout); -if (tmp >ULONG_MAX ) -return ULONG_MAX ; - -return tmp; + return min_t(unsigned long long, tmp, ULONG_MAX); }static int axi_clkgen_enable (struct clk_hw *clk_hw)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 7 lines · Stephen Boyd
The size of unsigned long on 64-bit architectures is equal to the size of u64, so this check is impossible there. This throws off static checkers:
drivers/clk/clk-axi-clkgen.c:331axi_clkgen_recalc_rate()warn:
impossible condition '(tmp > (~0)) => (0-u64max > u64max)'
Quoted 6 lines
Let's change this code to use
min_t()instead so that we get the same effect on architectures where sizeof(unsigned long) doesn't equal sizeof(u64).Cc Lars-Peter Clausen <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Thanks.