summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-12-14 21:40:10 +0300
committerLee Jones <lee@kernel.org>2023-12-21 17:42:59 +0300
commite7baa5b437a782308b86c1517ae252fd1353eb0b (patch)
tree46188108b0c46cfdf0d3f94784fdf73fe34c9b6e /drivers/leds
parent6d63d05e26f8d5e22308efc25793660101fd7602 (diff)
downloadlinux-e7baa5b437a782308b86c1517ae252fd1353eb0b.tar.xz
leds: max5970: Make use of dev_err_probe()
Simplify the error handling in probe function by switching from dev_err() to dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20231214184050.1272848-4-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-max5970.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/leds/leds-max5970.c b/drivers/leds/leds-max5970.c
index de57b385b4f6..60db3c28d7d9 100644
--- a/drivers/leds/leds-max5970.c
+++ b/drivers/leds/leds-max5970.c
@@ -62,7 +62,7 @@ static int max5970_led_probe(struct platform_device *pdev)
continue;
if (reg >= MAX5970_NUM_LEDS) {
- dev_err(dev, "invalid LED (%u >= %d)\n", reg, MAX5970_NUM_LEDS);
+ dev_err_probe(dev, -EINVAL, "invalid LED (%u >= %d)\n", reg, MAX5970_NUM_LEDS);
continue;
}
@@ -86,8 +86,7 @@ static int max5970_led_probe(struct platform_device *pdev)
ret = devm_led_classdev_register(dev, &ddata->cdev);
if (ret < 0) {
fwnode_handle_put(child);
- dev_err(dev, "Failed to initialize LED %u\n", reg);
- return ret;
+ return dev_err_probe(dev, ret, "Failed to initialize LED %u\n", reg);
}
}