* [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent()
@ 2018-12-14 21:49 Stephen Boyd
2018-12-14 22:29 ` Marek Vasut
2018-12-16 7:20 ` Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-12-14 21:49 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Marek Vasut, Alexey Firago,
Laurent Pinchart, linux-renesas-soc
It seems that it may be possible to get to the regmap update call
without ever initializing this variable, so just set it to 0 to be safe.
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Firago <alexey_firago@mentor.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/clk/clk-versaclock5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index 5b393e711e94..026f76276933 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -246,7 +246,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
struct vc5_driver_data *vc5 =
container_of(hw, struct vc5_driver_data, clk_mux);
const u8 mask = VC5_PRIM_SRC_SHDN_EN_XTAL | VC5_PRIM_SRC_SHDN_EN_CLKIN;
- u8 src;
+ u8 src = 0;
if ((index > 1) || !vc5->clk_mux_ins)
return -EINVAL;
--
Sent by a computer through tubes
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent()
2018-12-14 21:49 [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent() Stephen Boyd
@ 2018-12-14 22:29 ` Marek Vasut
2018-12-16 7:20 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2018-12-14 22:29 UTC (permalink / raw)
To: Stephen Boyd, Michael Turquette
Cc: linux-kernel, linux-clk, Marek Vasut, Alexey Firago,
Laurent Pinchart, linux-renesas-soc
On 12/14/2018 10:49 PM, Stephen Boyd wrote:
> It seems that it may be possible to get to the regmap update call
> without ever initializing this variable, so just set it to 0 to be safe.
>
> Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Firago <alexey_firago@mentor.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: linux-renesas-soc@vger.kernel.org
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
> drivers/clk/clk-versaclock5.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index 5b393e711e94..026f76276933 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -246,7 +246,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
> struct vc5_driver_data *vc5 =
> container_of(hw, struct vc5_driver_data, clk_mux);
> const u8 mask = VC5_PRIM_SRC_SHDN_EN_XTAL | VC5_PRIM_SRC_SHDN_EN_CLKIN;
> - u8 src;
> + u8 src = 0;
>
> if ((index > 1) || !vc5->clk_mux_ins)
> return -EINVAL;
Can you rather change the else { } branch in that function such that it does
if (vc5->clk_mux)ins == ...)
...
else if (...)
...
+ else
+ return -EINVAL;
The last bit would assure the function would fail in case the
clk_mux_ins == 0, which can happen if someone builds a setup without any
clock into connected to the VC5 (which would not work hardware-vise).
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent()
2018-12-14 21:49 [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent() Stephen Boyd
2018-12-14 22:29 ` Marek Vasut
@ 2018-12-16 7:20 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2018-12-16 7:20 UTC (permalink / raw)
To: Stephen Boyd
Cc: Michael Turquette, linux-kernel, linux-clk, Marek Vasut,
Alexey Firago, linux-renesas-soc
Hi Stephen,
On Friday, 14 December 2018 23:49:59 EET Stephen Boyd wrote:
> It seems that it may be possible to get to the regmap update call
> without ever initializing this variable, so just set it to 0 to be safe.
This can't happen as the probe() function would have failed first. I'd thus
add a comment to explain that the goal is only to silence a compiler warning.
> Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Firago <alexey_firago@mentor.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: linux-renesas-soc@vger.kernel.org
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
> drivers/clk/clk-versaclock5.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index 5b393e711e94..026f76276933 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -246,7 +246,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8
> index) struct vc5_driver_data *vc5 =
> container_of(hw, struct vc5_driver_data, clk_mux);
> const u8 mask = VC5_PRIM_SRC_SHDN_EN_XTAL | VC5_PRIM_SRC_SHDN_EN_CLKIN;
> - u8 src;
> + u8 src = 0;
>
> if ((index > 1) || !vc5->clk_mux_ins)
> return -EINVAL;
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-16 7:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 21:49 [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent() Stephen Boyd
2018-12-14 22:29 ` Marek Vasut
2018-12-16 7:20 ` Laurent Pinchart
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).