[PATCH] leds: lp5860: Fix unused-but-set-variable warning

Steffen Trumtrar posted 1 patch 2 weeks, 6 days ago
drivers/leds/rgb/leds-lp5860-core.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] leds: lp5860: Fix unused-but-set-variable warning
Posted by Steffen Trumtrar 2 weeks, 6 days ago
In lp5860_led_init the ret variable is set to the return value of
regmap_read. The ret is never returned or used which leads to a
-Wunused-but-set-variable warning.

Propagate the return value from the regmap_read and get rid of the warning.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/leds/rgb/leds-lp5860-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
index 3f41a42bb9abf..977741a070d19 100644
--- a/drivers/leds/rgb/leds-lp5860-core.c
+++ b/drivers/leds/rgb/leds-lp5860-core.c
@@ -72,6 +72,8 @@ static int lp5860_led_init(struct lp5860_led *led, struct fwnode_handle *fwnode,
 	int ret;
 
 	ret = regmap_read(led->chip->regmap, LP5860_REG_PWM_BRI_START + channel, &brightness);
+	if (ret)
+		return ret;
 
 	default_state = led_init_default_state_get(fwnode);
 

---
base-commit: 33e822f6f4eba2cfbd09ffd080af221cf8c542b2
change-id: 20260119-v6-19-topic-ti-lp5860-fixes-e31039e00146

Best regards,
-- 
Steffen Trumtrar <s.trumtrar@pengutronix.de>
Re: (subset) [PATCH] leds: lp5860: Fix unused-but-set-variable warning
Posted by Lee Jones 2 weeks, 3 days ago
On Mon, 19 Jan 2026 13:43:03 +0100, Steffen Trumtrar wrote:
> In lp5860_led_init the ret variable is set to the return value of
> regmap_read. The ret is never returned or used which leads to a
> -Wunused-but-set-variable warning.
> 
> Propagate the return value from the regmap_read and get rid of the warning.
> 
> 
> [...]

Applied, thanks!

[1/1] leds: lp5860: Fix unused-but-set-variable warning
      commit: 06915597fcc690896b7c3531a5686e7a312cd8c5

--
Lee Jones [李琼斯]