diff mbox series

[-next] iio: adc: ad7793: Add missing error code in ad7793_setup()

Message ID 20210514065431.4328-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] iio: adc: ad7793: Add missing error code in ad7793_setup() | expand

Commit Message

Yue Haibing May 14, 2021, 6:54 a.m. UTC
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@huawei.com>
---
 drivers/iio/adc/ad7793.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lars-Peter Clausen May 14, 2021, 7:36 a.m. UTC | #1
On 5/14/21 8:54 AM, YueHaibing wrote:
> 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@huawei.com>

Hi,

Thanks for finding and fixing this. One small comment.


> ---
>   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 = -EINVAL;
Usually we use ENODEV as the error code when the device ID does not match.
>   		dev_err(&st->sd.spi->dev, "device ID query failed\n");
>   		goto out;
>   	}
Yue Haibing May 14, 2021, 8 a.m. UTC | #2
On 2021/5/14 15:36, Lars-Peter Clausen wrote:
> On 5/14/21 8:54 AM, YueHaibing wrote:
>> 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@huawei.com>
> 
> Hi,
> 
> Thanks for finding and fixing this. One small comment.
> 
> 
>> ---
>>   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 = -EINVAL;
> Usually we use ENODEV as the error code when the device ID does not match.

Thanks, will send v2.

>>           dev_err(&st->sd.spi->dev, "device ID query failed\n");
>>           goto out;
>>       }
> 
> 
> .
diff mbox series

Patch

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 = -EINVAL;
 		dev_err(&st->sd.spi->dev, "device ID query failed\n");
 		goto out;
 	}