summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-10-16 18:10:01 +0200
committerLee Jones <lee@kernel.org>2023-11-01 12:29:20 +0100
commitf5ad594e389c57dfe19059ce868392809f9b1a71 (patch)
treec64179a5f8c665390ec0be65aed13c7ad9395dd2 /drivers/leds/leds-gpio.c
parentleds: gpio: Keep driver firmware interface agnostic (diff)
downloadlinux-f5ad594e389c57dfe19059ce868392809f9b1a71.tar.xz
linux-f5ad594e389c57dfe19059ce868392809f9b1a71.zip
leds: gpio: Utilise PTR_ERR_OR_ZERO()
Avoid a boilerplate code by using PTR_ERR_OR_ZERO() in create_gpio_led(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20231016161005.1471768-2-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/leds/leds-gpio.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index debadb48ceda..4071cb9eefec 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -125,16 +125,13 @@ static int create_gpio_led(const struct gpio_led *template,
return ret;
pinctrl = devm_pinctrl_get_select_default(led_dat->cdev.dev);
- if (IS_ERR(pinctrl)) {
- ret = PTR_ERR(pinctrl);
- if (ret != -ENODEV) {
- dev_warn(led_dat->cdev.dev,
- "Failed to select %pfw pinctrl: %d\n",
- fwnode, ret);
- } else {
- /* pinctrl-%d not present, not an error */
- ret = 0;
- }
+ ret = PTR_ERR_OR_ZERO(pinctrl);
+ /* pinctrl-%d not present, not an error */
+ if (ret == -ENODEV)
+ ret = 0;
+ if (ret) {
+ dev_warn(led_dat->cdev.dev, "Failed to select %pfw pinctrl: %d\n",
+ fwnode, ret);
}
return ret;