leds: tlc591xx: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
Krzysztof Kozlowski 2020-08-26 16:50:13 +02:00 committed by Pavel Machek
parent 4582e783a2
commit 03eb2ca44a
1 changed files with 4 additions and 6 deletions

View File

@ -213,12 +213,10 @@ tlc591xx_probe(struct i2c_client *client,
led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
err = devm_led_classdev_register_ext(dev, &led->ldev,
&init_data);
if (err < 0) {
if (err != -EPROBE_DEFER)
dev_err(dev, "couldn't register LED %s\n",
led->ldev.name);
return err;
}
if (err < 0)
return dev_err_probe(dev, err,
"couldn't register LED %s\n",
led->ldev.name);
}
return 0;
}