Skip to contentSkip to conversation

leds: blinkm: remove unused variable 'ret' in blinkm_init_hw()

PATCH In review Zhen Lei 2 participants 2 messages May 19, 2021 – Jun 23, 2021

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 leds: blinkm: remove unused variable 'ret' in blinkm_init_hw()

GCC reports the following warning with W=1:

drivers/leds/leds-blinkm.c:483:6: warning:
variable 'ret' set but not used [-Wunused-but-set-variable]

  483 |  int ret;
      |      ^~~

This variable is not used, remove it to fix the warning.

---
 drivers/leds/leds-blinkm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/leds/leds-blinkm.c +2 -3
index b4e1fdff4186..e34879b4c275 100644
@@ -480,9 +480,8 @@ static int blinkm_led_blue_set(struct led_classdev *led_cdev,
 
 static void blinkm_init_hw(struct i2c_client *client)
 {
-	int ret;
-	ret = blinkm_transfer_hw(client, BLM_STOP_SCRIPT);
-	ret = blinkm_transfer_hw(client, BLM_GO_RGB);
+	(void)blinkm_transfer_hw(client, BLM_STOP_SCRIPT);
+	(void)blinkm_transfer_hw(client, BLM_GO_RGB);
 }
 
 static int blinkm_test_run(struct i2c_client *client)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 11 lines · Zhen Lei

GCC reports the following warning with W=1:

drivers/leds/leds-blinkm.c:483:6: warning:
variable 'ret' set but not used [-Wunused-but-set-variable]

  483 |  int ret;
      |      ^~~

This variable is not used, remove it to fix the warning.

Sounds like valid warning, and likely function should just propagate the error value.

It would be good if someone with the hardware could take a look.

Best regards,
Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek