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

iio: chemical: scd30: 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>
Acked-by: default avatarTomasz Duszynski <tomasz.duszynski@octakon.com>
Link: https://lore.kernel.org/r/20200829064726.26268-11-krzk@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 8facae29
......@@ -705,13 +705,8 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv,
indio_dev->available_scan_masks = scd30_scan_masks;
state->vdd = devm_regulator_get(dev, "vdd");
if (IS_ERR(state->vdd)) {
if (PTR_ERR(state->vdd) == -EPROBE_DEFER)
return -EPROBE_DEFER;
dev_err(dev, "failed to get regulator\n");
return PTR_ERR(state->vdd);
}
if (IS_ERR(state->vdd))
return dev_err_probe(dev, PTR_ERR(state->vdd), "failed to get regulator\n");
ret = regulator_enable(state->vdd);
if (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