Commit 4dff7548 authored by Cai Huoqing's avatar Cai Huoqing Committed by Jonathan Cameron

iio: st_sensors: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210928014055.1431-1-caihuoqing@baidu.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent d1249ba7
......@@ -228,10 +228,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)
/* Regulators not mandatory, but if requested we should enable them. */
pdata->vdd = devm_regulator_get(parent, "vdd");
if (IS_ERR(pdata->vdd)) {
dev_err(&indio_dev->dev, "unable to get Vdd supply\n");
return PTR_ERR(pdata->vdd);
}
if (IS_ERR(pdata->vdd))
return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd),
"unable to get Vdd supply\n");
err = regulator_enable(pdata->vdd);
if (err != 0) {
dev_warn(&indio_dev->dev,
......@@ -244,10 +244,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)
return err;
pdata->vdd_io = devm_regulator_get(parent, "vddio");
if (IS_ERR(pdata->vdd_io)) {
dev_err(&indio_dev->dev, "unable to get Vdd_IO supply\n");
return PTR_ERR(pdata->vdd_io);
}
if (IS_ERR(pdata->vdd_io))
return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd_io),
"unable to get Vdd_IO supply\n");
err = regulator_enable(pdata->vdd_io);
if (err != 0) {
dev_warn(&indio_dev->dev,
......
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