* [PATCH] clk: visconti: Remove dead code @ 2022-01-28 16:35 ` Muhammad Usama Anjum 0 siblings, 0 replies; 4+ messages in thread From: Muhammad Usama Anjum @ 2022-01-28 16:35 UTC (permalink / raw) To: Michael Turquette, Stephen Boyd, Nobuhiro Iwamatsu Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-clk, linux-arm-kernel, linux-kernel rs_id is of unsigned type, u8. The condition rs_id >= 0 will always be true. Remove the if-else condition and the dead code. Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> --- drivers/clk/visconti/clkc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/clk/visconti/clkc.c b/drivers/clk/visconti/clkc.c index 56a8a4ffebca8..5ccf771d05985 100644 --- a/drivers/clk/visconti/clkc.c +++ b/drivers/clk/visconti/clkc.c @@ -147,13 +147,9 @@ int visconti_clk_register_gates(struct visconti_clk_provider *ctx, if (!dev_name) return -ENOMEM; - if (clks[i].rs_id >= 0) { - rson_offset = reset[clks[i].rs_id].rson_offset; - rsoff_offset = reset[clks[i].rs_id].rsoff_offset; - rs_idx = reset[clks[i].rs_id].rs_idx; - } else { - rson_offset = rsoff_offset = rs_idx = -1; - } + rson_offset = reset[clks[i].rs_id].rson_offset; + rsoff_offset = reset[clks[i].rs_id].rsoff_offset; + rs_idx = reset[clks[i].rs_id].rs_idx; div_clk = devm_clk_hw_register_fixed_factor(dev, dev_name, -- 2.30.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] clk: visconti: Remove dead code @ 2022-01-28 16:35 ` Muhammad Usama Anjum 0 siblings, 0 replies; 4+ messages in thread From: Muhammad Usama Anjum @ 2022-01-28 16:35 UTC (permalink / raw) To: Michael Turquette, Stephen Boyd, Nobuhiro Iwamatsu Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-clk, linux-arm-kernel, linux-kernel rs_id is of unsigned type, u8. The condition rs_id >= 0 will always be true. Remove the if-else condition and the dead code. Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> --- drivers/clk/visconti/clkc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/clk/visconti/clkc.c b/drivers/clk/visconti/clkc.c index 56a8a4ffebca8..5ccf771d05985 100644 --- a/drivers/clk/visconti/clkc.c +++ b/drivers/clk/visconti/clkc.c @@ -147,13 +147,9 @@ int visconti_clk_register_gates(struct visconti_clk_provider *ctx, if (!dev_name) return -ENOMEM; - if (clks[i].rs_id >= 0) { - rson_offset = reset[clks[i].rs_id].rson_offset; - rsoff_offset = reset[clks[i].rs_id].rsoff_offset; - rs_idx = reset[clks[i].rs_id].rs_idx; - } else { - rson_offset = rsoff_offset = rs_idx = -1; - } + rson_offset = reset[clks[i].rs_id].rson_offset; + rsoff_offset = reset[clks[i].rs_id].rsoff_offset; + rs_idx = reset[clks[i].rs_id].rs_idx; div_clk = devm_clk_hw_register_fixed_factor(dev, dev_name, -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: visconti: Remove dead code 2022-01-28 16:35 ` Muhammad Usama Anjum @ 2022-01-31 17:55 ` Dan Carpenter -1 siblings, 0 replies; 4+ messages in thread From: Dan Carpenter @ 2022-01-31 17:55 UTC (permalink / raw) To: Muhammad Usama Anjum Cc: Michael Turquette, Stephen Boyd, Nobuhiro Iwamatsu, kernel, kernel-janitors, linux-clk, linux-arm-kernel, linux-kernel On Fri, Jan 28, 2022 at 09:35:27PM +0500, Muhammad Usama Anjum wrote: > rs_id is of unsigned type, u8. The condition rs_id >= 0 will always be > true. Remove the if-else condition and the dead code. > No, this isn't the right fix. > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> > --- > drivers/clk/visconti/clkc.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/clk/visconti/clkc.c b/drivers/clk/visconti/clkc.c > index 56a8a4ffebca8..5ccf771d05985 100644 > --- a/drivers/clk/visconti/clkc.c > +++ b/drivers/clk/visconti/clkc.c > @@ -147,13 +147,9 @@ int visconti_clk_register_gates(struct visconti_clk_provider *ctx, > if (!dev_name) > return -ENOMEM; > > - if (clks[i].rs_id >= 0) { > - rson_offset = reset[clks[i].rs_id].rson_offset; > - rsoff_offset = reset[clks[i].rs_id].rsoff_offset; > - rs_idx = reset[clks[i].rs_id].rs_idx; > - } else { > - rson_offset = rsoff_offset = rs_idx = -1; > - } > + rson_offset = reset[clks[i].rs_id].rson_offset; > + rsoff_offset = reset[clks[i].rs_id].rsoff_offset; > + rs_idx = reset[clks[i].rs_id].rs_idx; With Smatch you can type: $ smdb.py where visconti_clk_gate_table rs_id drivers/clk/visconti/clkc-tmpv770x.c | (null) | (struct visconti_clk_gate_table)->rs_id | 0-31,255 That tells you it is assigned 255 as a global in drivers/clk/visconti/clkc-tmpv770x.c It takes some digging to find that assignment... drivers/clk/visconti/clkc-tmpv770x.c 175 /* PISYSTEM */ 176 { TMPV770X_CLK_WRCK, "wrck", 177 clks_parent_data, ARRAY_SIZE(clks_parent_data), 178 0, 0x68, 0x168, 9, 32, 179 -1, }, /* No reset */ ^^ Really, that -1 there should generate a static checker warning but it doesn't on Smatch... :/ But the probably the correct fix is to make rs_id and related variables and int instead of a u8. I saw this bug but just reported it instead of fixing it. regards, dan carpenter ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: visconti: Remove dead code @ 2022-01-31 17:55 ` Dan Carpenter 0 siblings, 0 replies; 4+ messages in thread From: Dan Carpenter @ 2022-01-31 17:55 UTC (permalink / raw) To: Muhammad Usama Anjum Cc: Michael Turquette, Stephen Boyd, Nobuhiro Iwamatsu, kernel, kernel-janitors, linux-clk, linux-arm-kernel, linux-kernel On Fri, Jan 28, 2022 at 09:35:27PM +0500, Muhammad Usama Anjum wrote: > rs_id is of unsigned type, u8. The condition rs_id >= 0 will always be > true. Remove the if-else condition and the dead code. > No, this isn't the right fix. > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> > --- > drivers/clk/visconti/clkc.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/clk/visconti/clkc.c b/drivers/clk/visconti/clkc.c > index 56a8a4ffebca8..5ccf771d05985 100644 > --- a/drivers/clk/visconti/clkc.c > +++ b/drivers/clk/visconti/clkc.c > @@ -147,13 +147,9 @@ int visconti_clk_register_gates(struct visconti_clk_provider *ctx, > if (!dev_name) > return -ENOMEM; > > - if (clks[i].rs_id >= 0) { > - rson_offset = reset[clks[i].rs_id].rson_offset; > - rsoff_offset = reset[clks[i].rs_id].rsoff_offset; > - rs_idx = reset[clks[i].rs_id].rs_idx; > - } else { > - rson_offset = rsoff_offset = rs_idx = -1; > - } > + rson_offset = reset[clks[i].rs_id].rson_offset; > + rsoff_offset = reset[clks[i].rs_id].rsoff_offset; > + rs_idx = reset[clks[i].rs_id].rs_idx; With Smatch you can type: $ smdb.py where visconti_clk_gate_table rs_id drivers/clk/visconti/clkc-tmpv770x.c | (null) | (struct visconti_clk_gate_table)->rs_id | 0-31,255 That tells you it is assigned 255 as a global in drivers/clk/visconti/clkc-tmpv770x.c It takes some digging to find that assignment... drivers/clk/visconti/clkc-tmpv770x.c 175 /* PISYSTEM */ 176 { TMPV770X_CLK_WRCK, "wrck", 177 clks_parent_data, ARRAY_SIZE(clks_parent_data), 178 0, 0x68, 0x168, 9, 32, 179 -1, }, /* No reset */ ^^ Really, that -1 there should generate a static checker warning but it doesn't on Smatch... :/ But the probably the correct fix is to make rs_id and related variables and int instead of a u8. I saw this bug but just reported it instead of fixing it. regards, dan carpenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-31 17:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-28 16:35 [PATCH] clk: visconti: Remove dead code Muhammad Usama Anjum 2022-01-28 16:35 ` Muhammad Usama Anjum 2022-01-31 17:55 ` Dan Carpenter 2022-01-31 17:55 ` Dan Carpenter
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.