[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240609233826.330516-13-vassilisamir@gmail.com>
Date: Mon, 10 Jun 2024 01:38:23 +0200
From: Vasileios Amoiridis <vassilisamir@...il.com>
To: jic23@...nel.org
Cc: dpfrey@...il.com,
himanshujha199640@...il.com,
lars@...afoo.de,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org,
mike.looijmans@...ic.nl,
vassilisamir@...il.com
Subject: [PATCH v3 12/15] iio: chemical: bme680: Move probe errors to dev_err_probe()
There are multiple cases in the probe function that dev_err_probe() fits
the needs, so use it.
Signed-off-by: Vasileios Amoiridis <vassilisamir@...il.com>
---
drivers/iio/chemical/bme680_core.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
index 0390c298fdd8..b357871ef601 100644
--- a/drivers/iio/chemical/bme680_core.c
+++ b/drivers/iio/chemical/bme680_core.c
@@ -866,18 +866,14 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
ret = regmap_write(regmap, BME680_REG_SOFT_RESET,
BME680_CMD_SOFTRESET);
- if (ret < 0) {
- dev_err(dev, "Failed to reset chip\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Failed to reset chip\n");
usleep_range(BME680_STARTUP_TIME_US, BME680_STARTUP_TIME_US + 1000);
ret = regmap_read(regmap, BME680_REG_CHIP_ID, &data->check);
- if (ret < 0) {
- dev_err(dev, "Error reading chip ID\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Error reading chip ID\n");
if (data->check != BME680_CHIP_ID_VAL) {
dev_err(dev, "Wrong chip ID, got %x expected %x\n",
@@ -887,22 +883,19 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
ret = bme680_read_calib(data, &data->bme680);
if (ret < 0) {
- dev_err(dev,
+ return dev_err_probe(dev, ret,
"failed to read calibration coefficients at probe\n");
- return ret;
}
ret = bme680_chip_config(data);
- if (ret < 0) {
- dev_err(dev, "failed to set chip_config data\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret,
+ "failed to set chip_config data\n");
ret = bme680_gas_config(data);
- if (ret < 0) {
- dev_err(dev, "failed to set gas config data\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret,
+ "failed to set gas config data\n");
return devm_iio_device_register(dev, indio_dev);
}
--
2.25.1
Powered by blists - more mailing lists