diff mbox series

[v6,3/8] iio: adc: stm32: Fixing err code to not indicate success

Message ID 20240330185305.1319844-4-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: Use device_for_each_child_scope() | expand

Commit Message

Jonathan Cameron March 30, 2024, 6:53 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This path would result in returning 0 / success on an error path.

Cc: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Fixes: 95bc818404b2 ("iio: adc: stm32-adc: add support of generic channels binding")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/stm32-adc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Fabrice Gasnier April 12, 2024, 12:31 p.m. UTC | #1
On 3/30/24 19:53, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> This path would result in returning 0 / success on an error path.
> 
> Cc: Olivier Moysan <olivier.moysan@foss.st.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Fixes: 95bc818404b2 ("iio: adc: stm32-adc: add support of generic channels binding")
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/adc/stm32-adc.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Hi Jonathan,

You can add my:
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Best Regards,
Thanks,
Fabrice

> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index b5d3c9cea5c4..283c20757106 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
> @@ -2234,6 +2234,7 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
>  			if (vin[0] != val || vin[1] >= adc_info->max_channels) {
>  				dev_err(&indio_dev->dev, "Invalid channel in%d-in%d\n",
>  					vin[0], vin[1]);
> +				ret = -EINVAL;
>  				goto err;
>  			}
>  		} else if (ret != -EINVAL) {
Jonathan Cameron April 13, 2024, 9:37 a.m. UTC | #2
On Fri, 12 Apr 2024 14:31:20 +0200
Fabrice Gasnier <fabrice.gasnier@foss.st.com> wrote:

> On 3/30/24 19:53, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > This path would result in returning 0 / success on an error path.
> > 
> > Cc: Olivier Moysan <olivier.moysan@foss.st.com>
> > Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> > Fixes: 95bc818404b2 ("iio: adc: stm32-adc: add support of generic channels binding")
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > ---
> >  drivers/iio/adc/stm32-adc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >   
> 
> Hi Jonathan,
> 
> You can add my:
> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Applied. I'll take this via the slow path and queue it for next merge window rather
than rushing it through as a fix.

Thanks

Jonathan


> 
> Best Regards,
> Thanks,
> Fabrice
> 
> > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> > index b5d3c9cea5c4..283c20757106 100644
> > --- a/drivers/iio/adc/stm32-adc.c
> > +++ b/drivers/iio/adc/stm32-adc.c
> > @@ -2234,6 +2234,7 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
> >  			if (vin[0] != val || vin[1] >= adc_info->max_channels) {
> >  				dev_err(&indio_dev->dev, "Invalid channel in%d-in%d\n",
> >  					vin[0], vin[1]);
> > +				ret = -EINVAL;
> >  				goto err;
> >  			}
> >  		} else if (ret != -EINVAL) {  
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index b5d3c9cea5c4..283c20757106 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -2234,6 +2234,7 @@  static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
 			if (vin[0] != val || vin[1] >= adc_info->max_channels) {
 				dev_err(&indio_dev->dev, "Invalid channel in%d-in%d\n",
 					vin[0], vin[1]);
+				ret = -EINVAL;
 				goto err;
 			}
 		} else if (ret != -EINVAL) {