Skip to contentSkip to conversation

clk: clocking-wizard: Remove redundant initialization of pointer div_addr

PATCH Applied Colin Ian King 3 participants 3 messages Feb 23, 2024 – Feb 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: clocking-wizard: Remove redundant initialization of pointer div_addr

The pointer div_addr is being assigned a value that is never used, it is being re-assigned a different value near the end of the function where it is being read in the next statement. The initialization is redundant and can be removed.

Cleans up clang scan build warning:
drivers/clk/xilinx/clk-xlnx-clock-wizard.c:501:16: warning: Value stored to 'div_addr' during its initialization is never read [deadcode.DeadStores]

---
 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/xilinx/clk-xlnx-clock-wizard.c +1 -1
index 6a6e5d9292e8..19eb3fb7ae31 100644
@@ -498,7 +498,7 @@ static int clk_wzrd_dynamic_all_nolock(struct clk_hw *hw, unsigned long rate,
 {
 	struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw);
 	unsigned long vco_freq, rate_div, clockout0_div;
-	void __iomem *div_addr = divider->base;
+	void __iomem *div_addr;
 	u32 reg, pre, f;
 	int err;
 
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Colin Ian King

The pointer div_addr is being assigned a value that is never used, it is being re-assigned a different value near the end of the function where it is being read in the next statement. The initialization is redundant and can be removed.

Cleans up clang scan build warning:
drivers/clk/xilinx/clk-xlnx-clock-wizard.c:501:16: warning: Value stored to 'div_addr' during its initialization is never read [deadcode.DeadStores]

---
  drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/xilinx/clk-xlnx-clock-wizard.c +0 -0
index 6a6e5d9292e8..19eb3fb7ae31 100644

drivers/clk/xilinx/clk-xlnx-clock-wizard.c static int clk_wzrd_dynamic_all_nolock(struct clk_hw *hw, unsigned long rate, · line 504

Quoted 8 lines
drivers/clk/xilinx/clk-xlnx-clock-wizard.c +1 -1
@@ -498,7 +498,7 @@ static int clk_wzrd_dynamic_all_nolock(struct clk_hw *hw, unsigned long rate,
  {
  	struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw);
  	unsigned long vco_freq, rate_div, clockout0_div;
-	void __iomem *div_addr = divider->base;
+	void __iomem *div_addr;
  	u32 reg, pre, f;
  	int err;
 

Thanks,
Michal

maintainer Applied
#2 lore raw
In reply to Colin Ian King

Quoting Colin Ian King (2024-02-23 05:43:47)

Quoted 11 lines

The pointer div_addr is being assigned a value that is never used, it is being re-assigned a different value near the end of the function where it is being read in the next statement. The initialization is redundant and can be removed.

Cleans up clang scan build warning:
drivers/clk/xilinx/clk-xlnx-clock-wizard.c:501:16: warning: Value stored to 'div_addr' during its initialization is never read [deadcode.DeadStores]

---

Applied to clk-next