* [PATCH] clk: mux: remove redundant initialization of variable width
@ 2022-04-24 18:22 Colin Ian King
2022-04-25 22:49 ` Stephen Boyd
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-04-24 18:22 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, linux-clk; +Cc: kernel-janitors, linux-kernel
Variable width is being ininitialized with a value that is never read.
The ininitializtion is redundant and can be removed. Move the variable
to the scope it is required.
Cleans up cppcheck warning:
Variable 'width' is assigned a value that is never used.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/clk/clk-mux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index 214045f6e989..fa817c317c2a 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -157,11 +157,11 @@ struct clk_hw *__clk_hw_register_mux(struct device *dev, struct device_node *np,
struct clk_mux *mux;
struct clk_hw *hw;
struct clk_init_data init = {};
- u8 width = 0;
int ret = -EINVAL;
if (clk_mux_flags & CLK_MUX_HIWORD_MASK) {
- width = fls(mask) - ffs(mask) + 1;
+ u8 width = fls(mask) - ffs(mask) + 1;
+
if (width + shift > 16) {
pr_err("mux value exceeds LOWORD field\n");
return ERR_PTR(-EINVAL);
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: mux: remove redundant initialization of variable width
2022-04-24 18:22 [PATCH] clk: mux: remove redundant initialization of variable width Colin Ian King
@ 2022-04-25 22:49 ` Stephen Boyd
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2022-04-25 22:49 UTC (permalink / raw)
To: Colin Ian King, Michael Turquette, linux-clk
Cc: kernel-janitors, linux-kernel
Quoting Colin Ian King (2022-04-24 11:22:27)
> Variable width is being ininitialized with a value that is never read.
> The ininitializtion is redundant and can be removed. Move the variable
> to the scope it is required.
>
> Cleans up cppcheck warning:
> Variable 'width' is assigned a value that is never used.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-25 22:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 18:22 [PATCH] clk: mux: remove redundant initialization of variable width Colin Ian King
2022-04-25 22:49 ` Stephen Boyd
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.