Commit ac73e222 authored by andy.shevchenko@gmail.com's avatar andy.shevchenko@gmail.com Committed by Jonathan Cameron

iio: st_sensors: lsm9ds0: Use dev_err_probe() everywhere

Use dev_err_probe() everywhere where it is appropriate.
Signed-off-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240211201526.1518165-2-andy.shevchenko@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 794ef0e5
...@@ -25,10 +25,9 @@ static int st_lsm9ds0_probe_accel(struct st_lsm9ds0 *lsm9ds0, struct regmap *reg ...@@ -25,10 +25,9 @@ static int st_lsm9ds0_probe_accel(struct st_lsm9ds0 *lsm9ds0, struct regmap *reg
struct st_sensor_data *data; struct st_sensor_data *data;
settings = st_accel_get_settings(lsm9ds0->name); settings = st_accel_get_settings(lsm9ds0->name);
if (!settings) { if (!settings)
dev_err(dev, "device name %s not recognized.\n", lsm9ds0->name); return dev_err_probe(dev, -ENODEV, "device name %s not recognized.\n",
return -ENODEV; lsm9ds0->name);
}
lsm9ds0->accel = devm_iio_device_alloc(dev, sizeof(*data)); lsm9ds0->accel = devm_iio_device_alloc(dev, sizeof(*data));
if (!lsm9ds0->accel) if (!lsm9ds0->accel)
...@@ -51,10 +50,9 @@ static int st_lsm9ds0_probe_magn(struct st_lsm9ds0 *lsm9ds0, struct regmap *regm ...@@ -51,10 +50,9 @@ static int st_lsm9ds0_probe_magn(struct st_lsm9ds0 *lsm9ds0, struct regmap *regm
struct st_sensor_data *data; struct st_sensor_data *data;
settings = st_magn_get_settings(lsm9ds0->name); settings = st_magn_get_settings(lsm9ds0->name);
if (!settings) { if (!settings)
dev_err(dev, "device name %s not recognized.\n", lsm9ds0->name); return dev_err_probe(dev, -ENODEV, "device name %s not recognized.\n",
return -ENODEV; lsm9ds0->name);
}
lsm9ds0->magn = devm_iio_device_alloc(dev, sizeof(*data)); lsm9ds0->magn = devm_iio_device_alloc(dev, sizeof(*data));
if (!lsm9ds0->magn) if (!lsm9ds0->magn)
...@@ -80,8 +78,7 @@ int st_lsm9ds0_probe(struct st_lsm9ds0 *lsm9ds0, struct regmap *regmap) ...@@ -80,8 +78,7 @@ int st_lsm9ds0_probe(struct st_lsm9ds0 *lsm9ds0, struct regmap *regmap)
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names), ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names),
regulator_names); regulator_names);
if (ret) if (ret)
return dev_err_probe(dev, ret, return dev_err_probe(dev, ret, "unable to enable Vdd supply\n");
"unable to enable Vdd supply\n");
/* Setup accelerometer device */ /* Setup accelerometer device */
ret = st_lsm9ds0_probe_accel(lsm9ds0, regmap); ret = st_lsm9ds0_probe_accel(lsm9ds0, regmap);
......
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