* [PATCH] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call
@ 2018-10-16 13:41 Enric Balletbo i Serra
2018-10-16 18:18 ` Stephen Boyd
2018-10-17 13:35 ` Heiko Stuebner
0 siblings, 2 replies; 3+ messages in thread
From: Enric Balletbo i Serra @ 2018-10-16 13:41 UTC (permalink / raw)
To: linux-kernel
Cc: kernel, Michael Turquette, Heiko Stuebner, Stephen Boyd,
linux-rockchip, linux-clk, linux-arm-kernel
Fixes the signedness bug returning '(-22)' on the return type by removing the
sanity checker in rockchip_ddrclk_get_parent(). The function should return
and unsigned value only and it's safe to remove the sanity checker as the
core functions that call get_parent like clk_core_get_parent_by_index already
ensures the validity of the clk index returned (index >= core->num_parents).
Fixes: a4f182bf81f18 ("clk: rockchip: add new clock-type for the ddrclk")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/clk/rockchip/clk-ddr.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c
index de00590af167..fd5c90371dbf 100644
--- a/drivers/clk/rockchip/clk-ddr.c
+++ b/drivers/clk/rockchip/clk-ddr.c
@@ -185,16 +185,12 @@ rockchip_ddrclk_sip_recalc_rate(struct clk_hw *hw,
static u8 rockchip_ddrclk_get_parent(struct clk_hw *hw)
{
struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw);
- int num_parents = clk_hw_get_num_parents(hw);
u32 val;
val = clk_readl(ddrclk->reg_base +
ddrclk->mux_offset) >> ddrclk->mux_shift;
val &= GENMASK(ddrclk->mux_width - 1, 0);
- if (val >= num_parents)
- return -EINVAL;
-
return val;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call
2018-10-16 13:41 [PATCH] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call Enric Balletbo i Serra
@ 2018-10-16 18:18 ` Stephen Boyd
2018-10-17 13:35 ` Heiko Stuebner
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-10-16 18:18 UTC (permalink / raw)
To: Enric Balletbo i Serra, linux-kernel
Cc: kernel, Michael Turquette, Heiko Stuebner, linux-rockchip,
linux-clk, linux-arm-kernel
Quoting Enric Balletbo i Serra (2018-10-16 06:41:44)
> Fixes the signedness bug returning '(-22)' on the return type by removing the
> sanity checker in rockchip_ddrclk_get_parent(). The function should return
> and unsigned value only and it's safe to remove the sanity checker as the
> core functions that call get_parent like clk_core_get_parent_by_index already
> ensures the validity of the clk index returned (index >= core->num_parents).
>
> Fixes: a4f182bf81f18 ("clk: rockchip: add new clock-type for the ddrclk")
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call
2018-10-16 13:41 [PATCH] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call Enric Balletbo i Serra
2018-10-16 18:18 ` Stephen Boyd
@ 2018-10-17 13:35 ` Heiko Stuebner
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Stuebner @ 2018-10-17 13:35 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: linux-kernel, kernel, Michael Turquette, Stephen Boyd,
linux-rockchip, linux-clk, linux-arm-kernel
Am Dienstag, 16. Oktober 2018, 15:41:44 CEST schrieb Enric Balletbo i Serra:
> Fixes the signedness bug returning '(-22)' on the return type by removing the
> sanity checker in rockchip_ddrclk_get_parent(). The function should return
> and unsigned value only and it's safe to remove the sanity checker as the
> core functions that call get_parent like clk_core_get_parent_by_index already
> ensures the validity of the clk index returned (index >= core->num_parents).
>
> Fixes: a4f182bf81f18 ("clk: rockchip: add new clock-type for the ddrclk")
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
applied to my clk-branch with Stephen's Review
Thanks
Heiko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-17 13:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 13:41 [PATCH] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call Enric Balletbo i Serra
2018-10-16 18:18 ` Stephen Boyd
2018-10-17 13:35 ` Heiko Stuebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).