[PATCH v2 -next] iio: adc: ad7793: Add missing error code in ad7793_setup()
From: YueHaibing
Date: Fri May 14 2021 - 04:03:39 EST
Set error code while device ID query failed.
Fixes: 88bc30548aae ("IIO: ADC: New driver for AD7792/AD7793 3 Channel SPI ADC")
Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
---
v2: use ENODEV instead of EINVAL
drivers/iio/adc/ad7793.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index 5e980a06258e..b4f9ac3838e1 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -279,6 +279,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
id &= AD7793_ID_MASK;
if (id != st->chip_info->id) {
+ ret = -ENODEV;
dev_err(&st->sd.spi->dev, "device ID query failed\n");
goto out;
}
--
2.17.1