Skip to content

Commit

Permalink
leds: lgm-sso: Propagate error codes from callee to caller
Browse files Browse the repository at this point in the history
[ Upstream commit 9cbc861 ]

The one of the latest change to the driver reveals the problem that
the error codes from callee aren't propagated to the caller of
__sso_led_dt_parse(). Fix this accordingly.

Fixes: 9999908 ("leds: lgm-sso: Put fwnode in any case during ->probe()")
Fixes: c3987cd ("leds: lgm: Add LED controller driver for LGM SoC")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
andy-shev authored and gregkh committed Sep 15, 2021
1 parent 287b4cc commit 94c4af7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/leds/blink/leds-lgm-sso.c
Expand Up @@ -643,7 +643,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
fwnode_child,
GPIOD_ASIS, NULL);
if (IS_ERR(led->gpiod)) {
dev_err_probe(dev, PTR_ERR(led->gpiod), "led: get gpio fail!\n");
ret = dev_err_probe(dev, PTR_ERR(led->gpiod), "led: get gpio fail!\n");
goto __dt_err;
}

Expand All @@ -663,8 +663,11 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
desc->panic_indicator = 1;

ret = fwnode_property_read_u32(fwnode_child, "reg", &prop);
if (ret != 0 || prop >= SSO_LED_MAX_NUM) {
if (ret)
goto __dt_err;
if (prop >= SSO_LED_MAX_NUM) {
dev_err(dev, "invalid LED pin:%u\n", prop);
ret = -EINVAL;
goto __dt_err;
}
desc->pin = prop;
Expand Down Expand Up @@ -700,7 +703,8 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
desc->brightness = LED_FULL;
}

if (sso_create_led(priv, led, fwnode_child))
ret = sso_create_led(priv, led, fwnode_child);
if (ret)
goto __dt_err;
}

Expand All @@ -714,7 +718,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
sso_led_shutdown(led);
}

return -EINVAL;
return ret;
}

static int sso_led_dt_parse(struct sso_led_priv *priv)
Expand Down

0 comments on commit 94c4af7

Please sign in to comment.