All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: socfpga: remove redundant assignment after a mask operation
@ 2021-12-30 15:03 Colin Ian King
  2021-12-30 18:10 ` Dinh Nguyen
  2022-01-06  0:33 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2021-12-30 15:03 UTC (permalink / raw)
  To: Dinh Nguyen, Michael Turquette, Stephen Boyd, Nathan Chancellor,
	Nick Desaulniers, linux-clk
  Cc: kernel-janitors, llvm, linux-kernel

The assignment operation after a & mask operation is redundant, the
variables being assigned are not used afterwards. Replace the &=
operator with just & operator.

Cleans up two clang-scan warnings:
drivers/clk/socfpga/clk-gate.c:37:10: warning: Although the value stored
to 'l4_src' is used in the enclosing expression, the value is never
actually read from 'l4_src' [deadcode.DeadStores]
                return l4_src &= 0x1;
                       ^         ~~~
drivers/clk/socfpga/clk-gate.c:46:10: warning: Although the value stored
to 'perpll_src' is used in the enclosing expression, the value is never
actually read from 'perpll_src' [deadcode.DeadStores]
                return perpll_src &= 0x3;

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/clk/socfpga/clk-gate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
index 1ec9678d8cd3..53d6e3ec4309 100644
--- a/drivers/clk/socfpga/clk-gate.c
+++ b/drivers/clk/socfpga/clk-gate.c
@@ -34,7 +34,7 @@ static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)
 
 	if (streq(name, SOCFPGA_L4_MP_CLK)) {
 		l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
-		return l4_src &= 0x1;
+		return l4_src & 0x1;
 	}
 	if (streq(name, SOCFPGA_L4_SP_CLK)) {
 		l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
@@ -43,7 +43,7 @@ static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)
 
 	perpll_src = readl(clk_mgr_base_addr + CLKMGR_PERPLL_SRC);
 	if (streq(name, SOCFPGA_MMC_CLK))
-		return perpll_src &= 0x3;
+		return perpll_src & 0x3;
 	if (streq(name, SOCFPGA_NAND_CLK) ||
 	    streq(name, SOCFPGA_NAND_X_CLK))
 		return (perpll_src >> 2) & 3;
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: socfpga: remove redundant assignment after a mask operation
  2021-12-30 15:03 [PATCH] clk: socfpga: remove redundant assignment after a mask operation Colin Ian King
@ 2021-12-30 18:10 ` Dinh Nguyen
  2022-01-06  0:33 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Dinh Nguyen @ 2021-12-30 18:10 UTC (permalink / raw)
  To: Colin Ian King, Michael Turquette, Stephen Boyd,
	Nathan Chancellor, Nick Desaulniers, linux-clk
  Cc: kernel-janitors, llvm, linux-kernel



On 12/30/21 9:03 AM, Colin Ian King wrote:
> The assignment operation after a & mask operation is redundant, the
> variables being assigned are not used afterwards. Replace the &=
> operator with just & operator.
> 
> Cleans up two clang-scan warnings:
> drivers/clk/socfpga/clk-gate.c:37:10: warning: Although the value stored
> to 'l4_src' is used in the enclosing expression, the value is never
> actually read from 'l4_src' [deadcode.DeadStores]
>                  return l4_src &= 0x1;
>                         ^         ~~~
> drivers/clk/socfpga/clk-gate.c:46:10: warning: Although the value stored
> to 'perpll_src' is used in the enclosing expression, the value is never
> actually read from 'perpll_src' [deadcode.DeadStores]
>                  return perpll_src &= 0x3;
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>   drivers/clk/socfpga/clk-gate.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
> index 1ec9678d8cd3..53d6e3ec4309 100644
> --- a/drivers/clk/socfpga/clk-gate.c
> +++ b/drivers/clk/socfpga/clk-gate.c
> @@ -34,7 +34,7 @@ static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)
>   
>   	if (streq(name, SOCFPGA_L4_MP_CLK)) {
>   		l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
> -		return l4_src &= 0x1;
> +		return l4_src & 0x1;
>   	}
>   	if (streq(name, SOCFPGA_L4_SP_CLK)) {
>   		l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
> @@ -43,7 +43,7 @@ static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)
>   
>   	perpll_src = readl(clk_mgr_base_addr + CLKMGR_PERPLL_SRC);
>   	if (streq(name, SOCFPGA_MMC_CLK))
> -		return perpll_src &= 0x3;
> +		return perpll_src & 0x3;
>   	if (streq(name, SOCFPGA_NAND_CLK) ||
>   	    streq(name, SOCFPGA_NAND_X_CLK))
>   		return (perpll_src >> 2) & 3;
> 

Acked-by: Dinh Nguyen <dinguyen@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: socfpga: remove redundant assignment after a mask operation
  2021-12-30 15:03 [PATCH] clk: socfpga: remove redundant assignment after a mask operation Colin Ian King
  2021-12-30 18:10 ` Dinh Nguyen
@ 2022-01-06  0:33 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2022-01-06  0:33 UTC (permalink / raw)
  To: Colin Ian King, Dinh Nguyen, Michael Turquette,
	Nathan Chancellor, Nick Desaulniers, linux-clk
  Cc: kernel-janitors, llvm, linux-kernel

Quoting Colin Ian King (2021-12-30 07:03:21)
> The assignment operation after a & mask operation is redundant, the
> variables being assigned are not used afterwards. Replace the &=
> operator with just & operator.
> 
> Cleans up two clang-scan warnings:
> drivers/clk/socfpga/clk-gate.c:37:10: warning: Although the value stored
> to 'l4_src' is used in the enclosing expression, the value is never
> actually read from 'l4_src' [deadcode.DeadStores]
>                 return l4_src &= 0x1;
>                        ^         ~~~
> drivers/clk/socfpga/clk-gate.c:46:10: warning: Although the value stored
> to 'perpll_src' is used in the enclosing expression, the value is never
> actually read from 'perpll_src' [deadcode.DeadStores]
>                 return perpll_src &= 0x3;
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-06  0:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 15:03 [PATCH] clk: socfpga: remove redundant assignment after a mask operation Colin Ian King
2021-12-30 18:10 ` Dinh Nguyen
2022-01-06  0:33 ` 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.