]> www.infradead.org Git - users/dwmw2/linux.git/commit
clk: sunxi: Fix incorrect usage of round_down()
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Tue, 17 Mar 2020 21:13:32 +0000 (22:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:17 +0000 (17:48 +0200)
commit59b76e6d667985e0c19c57e84d15a62a78a5c730
tree9c4bafd7e2623f36ae997de2ca42f072cba47c1e
parent27bc8ad4802919d89c5c7ce5e67d6f110165047a
clk: sunxi: Fix incorrect usage of round_down()

[ Upstream commit ee25d9742dabed3fd18158b518f846abeb70f319 ]

round_down() can only round to powers of 2. If round_down() is asked
to round to something that is not a power of 2, incorrect results are
produced. The incorrect results can be both too large and too small.

Instead, use rounddown() which can round to any number.

Fixes: 6a721db180a2 ("clk: sunxi: Add A31 clocks support")
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/sunxi/clk-sunxi.c