[PATCH 6/7] iio: dac: ad7293: use dev_err_probe in probe path

Antoniu Miclaus posted 7 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH 6/7] iio: dac: ad7293: use dev_err_probe in probe path
Posted by Antoniu Miclaus 1 month, 1 week ago
Replace dev_err() + return with dev_err_probe() in ad7293_init(),
which is called during probe. This simplifies error handling.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/dac/ad7293.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/ad7293.c b/drivers/iio/dac/ad7293.c
index c3797e40cdd9..acee565d5bb7 100644
--- a/drivers/iio/dac/ad7293.c
+++ b/drivers/iio/dac/ad7293.c
@@ -821,10 +821,9 @@ static int ad7293_init(struct ad7293_state *st)
 	if (ret)
 		return ret;
 
-	if (chip_id != AD7293_CHIP_ID) {
-		dev_err(&spi->dev, "Invalid Chip ID.\n");
-		return -EINVAL;
-	}
+	if (chip_id != AD7293_CHIP_ID)
+		return dev_err_probe(&spi->dev, -EINVAL,
+				     "Invalid Chip ID.\n");
 
 	if (!st->vrefin_en)
 		return __ad7293_spi_update_bits(st, AD7293_REG_GENERAL,
-- 
2.43.0