[PATCH 2/5] leds: lp8860: Return directly from lp8860_init

Andrew Davis
2026-03-05T20:37:15Z

No need to use goto to jump to a label that also just returns,
return directly in the if statements.

Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/leds/leds-lp8860.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
index 87d298b6be7d0..71dcd55f0808f 100644
--- a/drivers/leds/leds-lp8860.c
+++ b/drivers/leds/leds-lp8860.c
@@ -216,41 +216,38 @@ static int lp8860_init(struct lp8860_led *led)

ret = lp8860_fault_check(led);
if (ret)
- goto out;
+ return ret;

ret = regmap_read(led->regmap, LP8860_STATUS, &read_buf);
if (ret)
- goto out;
+ return ret;

ret = lp8860_unlock_eeprom(led);
if (ret) {
dev_err(&led->client->dev, "Failed unlocking EEPROM\n");
- goto out;
+ return ret;
}

reg_count = ARRAY_SIZE(lp8860_eeprom_disp_regs);
ret = regmap_multi_reg_write(led->regmap, lp8860_eeprom_disp_regs, reg_count);
if (ret) {
dev_err(&led->client->dev, "Failed writing EEPROM\n");
- goto out;
+ return ret;
}

ret = regmap_write(led->regmap, LP8860_EEPROM_UNLOCK, LP8860_LOCK_EEPROM);
if (ret)
- goto out;
+ return ret;

ret = regmap_write(led->regmap,
LP8860_EEPROM_CNTRL,
LP8860_PROGRAM_EEPROM);
if (ret) {
dev_err(&led->client->dev, "Failed programming EEPROM\n");
- goto out;
+ return ret;
}

- return ret;
-
-out:
- return ret;
+ return 0;
}

static const struct regmap_range lp8860_reg_ranges[] = {
--
2.39.2