mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 05:33:09 +00:00
iio: dac: dpot-dac: 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> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Peter Rosin <peda@axentia.se> Link: https://lore.kernel.org/r/20200829064726.26268-12-krzk@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
ed1759093c
commit
a567abf66e
@ -183,18 +183,14 @@ static int dpot_dac_probe(struct platform_device *pdev)
|
|||||||
indio_dev->num_channels = 1;
|
indio_dev->num_channels = 1;
|
||||||
|
|
||||||
dac->vref = devm_regulator_get(dev, "vref");
|
dac->vref = devm_regulator_get(dev, "vref");
|
||||||
if (IS_ERR(dac->vref)) {
|
if (IS_ERR(dac->vref))
|
||||||
if (PTR_ERR(dac->vref) != -EPROBE_DEFER)
|
return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref),
|
||||||
dev_err(&pdev->dev, "failed to get vref regulator\n");
|
"failed to get vref regulator\n");
|
||||||
return PTR_ERR(dac->vref);
|
|
||||||
}
|
|
||||||
|
|
||||||
dac->dpot = devm_iio_channel_get(dev, "dpot");
|
dac->dpot = devm_iio_channel_get(dev, "dpot");
|
||||||
if (IS_ERR(dac->dpot)) {
|
if (IS_ERR(dac->dpot))
|
||||||
if (PTR_ERR(dac->dpot) != -EPROBE_DEFER)
|
return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot),
|
||||||
dev_err(dev, "failed to get dpot input channel\n");
|
"failed to get dpot input channel\n");
|
||||||
return PTR_ERR(dac->dpot);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = iio_get_channel_type(dac->dpot, &type);
|
ret = iio_get_channel_type(dac->dpot, &type);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user