Commit eb17f3ed authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Jonathan Cameron

iio: light: tsl2772: 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: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-15-krzk@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 17b7d923
...@@ -1776,14 +1776,8 @@ static int tsl2772_probe(struct i2c_client *clientp, ...@@ -1776,14 +1776,8 @@ static int tsl2772_probe(struct i2c_client *clientp,
ret = devm_regulator_bulk_get(&clientp->dev, ret = devm_regulator_bulk_get(&clientp->dev,
ARRAY_SIZE(chip->supplies), ARRAY_SIZE(chip->supplies),
chip->supplies); chip->supplies);
if (ret < 0) { if (ret < 0)
if (ret != -EPROBE_DEFER) return dev_err_probe(&clientp->dev, ret, "Failed to get regulators\n");
dev_err(&clientp->dev,
"Failed to get regulators: %d\n",
ret);
return ret;
}
ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies); ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies);
if (ret < 0) { if (ret < 0) {
......
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