Skip to contentSkip to conversation

power: supply: ab8500: remove unused static local variable

PATCH In review Tom Rix 5 participants 6 messages Jul 19, 2022 – Sep 12, 2022

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 power: supply: ab8500: remove unused static local variable

cpp_check reports
[drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used.

From inspection, this variable is never used. So remove it.

Fixes 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers")
---
 drivers/power/supply/ab8500_chargalg.c | 2 --
 1 file changed, 2 deletions(-)
drivers/power/supply/ab8500_chargalg.c +0 -2
index ae4be553f424..05146d436a6a 100644
@@ -490,8 +490,6 @@ static int ab8500_chargalg_kick_watchdog(struct ab8500_chargalg *di)
 static int ab8500_chargalg_ac_en(struct ab8500_chargalg *di, int enable,
 	int vset_uv, int iset_ua)
 {
-	static int ab8500_chargalg_ex_ac_enable_toggle;
-
 	if (!di->ac_chg || !di->ac_chg->ops.enable)
 		return -ENXIO;
 
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Tom Rix

cpp_check reports
[drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used.

From inspection, this variable is never used. So remove it.

Fixes 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers")

Thanks Tom!

Yours,
Linus Walleij

#2 lore raw
Quoted 5 lines
Quoted 5 lines

cpp_check reports
[drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used.

From inspection, this variable is never used. So remove it.

Quoted 8 lines
Quoted 2 lines
Fixes 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers")

Thanks Tom!

Yours,
Linus Walleij

Hi Sebastian,

It looks like that this patch is not in linux-next 20220812
and I can still observe this build error with ARCH=arm, defconfig=allyesconfig.

Would you pick up this fix, please?

Thanks,
Miles

Reviewed-by on v1 1/1
#3 lore raw
In reply to Tom Rix
Quoted 17 lines · Tom Rix

cpp_check reports
[drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used.

Quoted 1 line

From inspection, this variable is never used. So remove it.

Fixes 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers")
---
  drivers/power/supply/ab8500_chargalg.c | 2 --
  1 file changed, 2 deletions(-)
drivers/power/supply/ab8500_chargalg.c +0 -0
index ae4be553f424..05146d436a6a 100644

drivers/power/supply/ab8500_chargalg.c static int ab8500_chargalg_kick_watchdog(struct ab8500_chargalg *di) · line 495

Quoted 8 lines
drivers/power/supply/ab8500_chargalg.c +0 -2
@@ -490,8 +490,6 @@ static int ab8500_chargalg_kick_watchdog(struct ab8500_chargalg *di)
  static int ab8500_chargalg_ac_en(struct ab8500_chargalg *di, int enable,
  	int vset_uv, int iset_ua)
  {
-	static int ab8500_chargalg_ex_ac_enable_toggle;
-
  	if (!di->ac_chg || !di->ac_chg->ops.enable)
  		return -ENXIO;
 

I can still observe this build error with ARCH=arm, defconfig=allyesconfig in linux-next next-200816:

drivers/power/supply/ab8500_chargalg.c: In function ‘ab8500_chargalg_ac_en’:
drivers/power/supply/ab8500_chargalg.c:493:13: error: unused variable ‘ab8500_chargalg_ex_ac_enable_toggle’ [-Werror=unused-variable]

  static int ab8500_chargalg_ex_ac_enable_toggle;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reviewed-by
#4 lore raw
Quoted 30 lines · chenlifu
Quoted 17 lines · Tom Rix

cpp_check reports
[drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used.

Quoted 1 line

From inspection, this variable is never used. So remove it.

Fixes 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers")

---
  drivers/power/supply/ab8500_chargalg.c | 2 --

  1 file changed, 2 deletions(-)
drivers/power/supply/ab8500_chargalg.c +0 -0
index ae4be553f424..05146d436a6a 100644

drivers/power/supply/ab8500_chargalg.c static int ab8500_chargalg_kick_watchdog(struct · line 495

Quoted 8 lines
drivers/power/supply/ab8500_chargalg.c +0 -2
@@ -490,8 +490,6 @@ static int ab8500_chargalg_kick_watchdog(struct 
 ab8500_chargalg *di)
   static int ab8500_chargalg_ac_en(struct ab8500_chargalg *di, int enable,
       int vset_uv, int iset_ua)
   {
-    static int ab8500_chargalg_ex_ac_enable_toggle;
-
       if (!di->ac_chg || !di->ac_chg->ops.enable)
           return -ENXIO;
Quoted 7 lines

I can still observe this build error with ARCH=arm, defconfig=allyesconfig in linux-next next-200816:

drivers/power/supply/ab8500_chargalg.c: In function ‘ab8500_chargalg_ac_en’:
drivers/power/supply/ab8500_chargalg.c:493:13: error: unused variable ‘ab8500_chargalg_ex_ac_enable_toggle’ [-Werror=unused-variable]
 static int ab8500_chargalg_ex_ac_enable_toggle;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.

fixed the tag: next-200816 --> next-20220816

I can still observe this build error with ARCH=arm, defconfig=allyesconfig in linux-next next-20220816:

drivers/power/supply/ab8500_chargalg.c: In function ‘ab8500_chargalg_ac_en’:
drivers/power/supply/ab8500_chargalg.c:493:13: error: unused variable ‘ab8500_chargalg_ex_ac_enable_toggle’ [-Werror=unused-variable]

 static int ab8500_chargalg_ex_ac_enable_toggle;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#5 lore raw
In reply to Tom Rix

Hi,

Quoted 8 lines · Tom Rix

cpp_check reports
[drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used.

From inspection, this variable is never used. So remove it.

Fixes 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers")

---

Thanks, queued into power-supply's fixes branch.
Sorry for the delay.

-- Sebastian

Quoted 19 lines
 drivers/power/supply/ab8500_chargalg.c | 2 --
 1 file changed, 2 deletions(-)
drivers/power/supply/ab8500_chargalg.c +0 -2
index ae4be553f424..05146d436a6a 100644
@@ -490,8 +490,6 @@ static int ab8500_chargalg_kick_watchdog(struct ab8500_chargalg *di)
 static int ab8500_chargalg_ac_en(struct ab8500_chargalg *di, int enable,
 	int vset_uv, int iset_ua)
 {
-	static int ab8500_chargalg_ex_ac_enable_toggle;
-
 	if (!di->ac_chg || !di->ac_chg->ops.enable)
 		return -ENXIO;
 
Signature · 1 line
2.27.0