* [PATCH][next] clk: socfpga: remove redundant initialization of variable div
@ 2021-04-06 18:27 Colin King
2021-04-06 18:37 ` Dinh Nguyen
2021-04-07 23:30 ` Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-04-06 18:27 UTC (permalink / raw)
To: Dinh Nguyen, Michael Turquette, Stephen Boyd, linux-clk
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The variable div is being initialized with a value that is
never read and it is being updated later with a new value. The
initialization is redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/clk/socfpga/clk-gate-s10.c | 2 +-
drivers/clk/socfpga/clk-pll-s10.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/socfpga/clk-gate-s10.c b/drivers/clk/socfpga/clk-gate-s10.c
index f9f403d7bb58..b84f2627551e 100644
--- a/drivers/clk/socfpga/clk-gate-s10.c
+++ b/drivers/clk/socfpga/clk-gate-s10.c
@@ -31,7 +31,7 @@ static unsigned long socfpga_dbg_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
- u32 div = 1, val;
+ u32 div, val;
val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
val &= GENMASK(socfpgaclk->width - 1, 0);
diff --git a/drivers/clk/socfpga/clk-pll-s10.c b/drivers/clk/socfpga/clk-pll-s10.c
index bc37461d43c0..70076a80149d 100644
--- a/drivers/clk/socfpga/clk-pll-s10.c
+++ b/drivers/clk/socfpga/clk-pll-s10.c
@@ -107,7 +107,7 @@ static unsigned long clk_boot_clk_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate)
{
struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
- u32 div = 1;
+ u32 div;
div = ((readl(socfpgaclk->hw.reg) &
SWCTRLBTCLKSEL_MASK) >>
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] clk: socfpga: remove redundant initialization of variable div
2021-04-06 18:27 [PATCH][next] clk: socfpga: remove redundant initialization of variable div Colin King
@ 2021-04-06 18:37 ` Dinh Nguyen
2021-04-07 23:30 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Dinh Nguyen @ 2021-04-06 18:37 UTC (permalink / raw)
To: Colin King, Michael Turquette, Stephen Boyd, linux-clk
Cc: kernel-janitors, linux-kernel
On 4/6/21 1:27 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable div is being initialized with a value that is
> never read and it is being updated later with a new value. The
> initialization is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/clk/socfpga/clk-gate-s10.c | 2 +-
> drivers/clk/socfpga/clk-pll-s10.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/socfpga/clk-gate-s10.c b/drivers/clk/socfpga/clk-gate-s10.c
> index f9f403d7bb58..b84f2627551e 100644
> --- a/drivers/clk/socfpga/clk-gate-s10.c
> +++ b/drivers/clk/socfpga/clk-gate-s10.c
> @@ -31,7 +31,7 @@ static unsigned long socfpga_dbg_clk_recalc_rate(struct clk_hw *hwclk,
> unsigned long parent_rate)
> {
> struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
> - u32 div = 1, val;
> + u32 div, val;
>
> val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
> val &= GENMASK(socfpgaclk->width - 1, 0);
> diff --git a/drivers/clk/socfpga/clk-pll-s10.c b/drivers/clk/socfpga/clk-pll-s10.c
> index bc37461d43c0..70076a80149d 100644
> --- a/drivers/clk/socfpga/clk-pll-s10.c
> +++ b/drivers/clk/socfpga/clk-pll-s10.c
> @@ -107,7 +107,7 @@ static unsigned long clk_boot_clk_recalc_rate(struct clk_hw *hwclk,
> unsigned long parent_rate)
> {
> struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
> - u32 div = 1;
> + u32 div;
>
> div = ((readl(socfpgaclk->hw.reg) &
> SWCTRLBTCLKSEL_MASK) >>
>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] clk: socfpga: remove redundant initialization of variable div
2021-04-06 18:27 [PATCH][next] clk: socfpga: remove redundant initialization of variable div Colin King
2021-04-06 18:37 ` Dinh Nguyen
@ 2021-04-07 23:30 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2021-04-07 23:30 UTC (permalink / raw)
To: Colin King, Dinh Nguyen, Michael Turquette, linux-clk
Cc: kernel-janitors, linux-kernel
Quoting Colin King (2021-04-06 11:27:46)
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable div is being initialized with a value that is
> never read and it is being updated later with a new value. The
> initialization is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-07 23:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 18:27 [PATCH][next] clk: socfpga: remove redundant initialization of variable div Colin King
2021-04-06 18:37 ` Dinh Nguyen
2021-04-07 23:30 ` Stephen Boyd
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).