linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] iio: adc: ad7793: Add missing error code in ad7793_setup()
@ 2021-05-14  6:54 YueHaibing
  2021-05-14  7:36 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2021-05-14  6:54 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, yuehaibing, gregkh
  Cc: linux-iio, linux-kernel

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(+)

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;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] iio: adc: ad7793: Add missing error code in ad7793_setup()
  2021-05-14  6:54 [PATCH -next] iio: adc: ad7793: Add missing error code in ad7793_setup() YueHaibing
@ 2021-05-14  7:36 ` Lars-Peter Clausen
  2021-05-14  8:00   ` YueHaibing
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2021-05-14  7:36 UTC (permalink / raw)
  To: YueHaibing, Michael.Hennerich, jic23, gregkh; +Cc: linux-iio, linux-kernel

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;
>   	}



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] iio: adc: ad7793: Add missing error code in ad7793_setup()
  2021-05-14  7:36 ` Lars-Peter Clausen
@ 2021-05-14  8:00   ` YueHaibing
  0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2021-05-14  8:00 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael.Hennerich, jic23, gregkh
  Cc: linux-iio, linux-kernel

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;
>>       }
> 
> 
> .

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-14  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14  6:54 [PATCH -next] iio: adc: ad7793: Add missing error code in ad7793_setup() YueHaibing
2021-05-14  7:36 ` Lars-Peter Clausen
2021-05-14  8:00   ` YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).