iio: st_lsm9ds0: 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: Cai Huoqing <caihuoqing@baidu.com> Link: https://lore.kernel.org/r/20210928014055.1431-2-caihuoqing@baidu.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Родитель
4dff754876
Коммит
b42baaa3e2
|
@ -24,10 +24,10 @@ static int st_lsm9ds0_power_enable(struct device *dev, struct st_lsm9ds0 *lsm9ds
|
|||
|
||||
/* Regulators not mandatory, but if requested we should enable them. */
|
||||
lsm9ds0->vdd = devm_regulator_get(dev, "vdd");
|
||||
if (IS_ERR(lsm9ds0->vdd)) {
|
||||
dev_err(dev, "unable to get Vdd supply\n");
|
||||
return PTR_ERR(lsm9ds0->vdd);
|
||||
}
|
||||
if (IS_ERR(lsm9ds0->vdd))
|
||||
return dev_err_probe(dev, PTR_ERR(lsm9ds0->vdd),
|
||||
"unable to get Vdd supply\n");
|
||||
|
||||
ret = regulator_enable(lsm9ds0->vdd);
|
||||
if (ret) {
|
||||
dev_warn(dev, "Failed to enable specified Vdd supply\n");
|
||||
|
@ -36,9 +36,9 @@ static int st_lsm9ds0_power_enable(struct device *dev, struct st_lsm9ds0 *lsm9ds
|
|||
|
||||
lsm9ds0->vdd_io = devm_regulator_get(dev, "vddio");
|
||||
if (IS_ERR(lsm9ds0->vdd_io)) {
|
||||
dev_err(dev, "unable to get Vdd_IO supply\n");
|
||||
regulator_disable(lsm9ds0->vdd);
|
||||
return PTR_ERR(lsm9ds0->vdd_io);
|
||||
return dev_err_probe(dev, PTR_ERR(lsm9ds0->vdd_io),
|
||||
"unable to get Vdd_IO supply\n");
|
||||
}
|
||||
ret = regulator_enable(lsm9ds0->vdd_io);
|
||||
if (ret) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче