Commit e7baa5b4 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Lee Jones

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231214184050.1272848-4-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 6d63d05e
...@@ -62,7 +62,7 @@ static int max5970_led_probe(struct platform_device *pdev) ...@@ -62,7 +62,7 @@ static int max5970_led_probe(struct platform_device *pdev)
continue; continue;
if (reg >= MAX5970_NUM_LEDS) { 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; continue;
} }
...@@ -86,8 +86,7 @@ static int max5970_led_probe(struct platform_device *pdev) ...@@ -86,8 +86,7 @@ static int max5970_led_probe(struct platform_device *pdev)
ret = devm_led_classdev_register(dev, &ddata->cdev); ret = devm_led_classdev_register(dev, &ddata->cdev);
if (ret < 0) { if (ret < 0) {
fwnode_handle_put(child); fwnode_handle_put(child);
dev_err(dev, "Failed to initialize LED %u\n", reg); return dev_err_probe(dev, ret, "Failed to initialize LED %u\n", reg);
return ret;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment