Subject: Re: [PATCH 01/30] iio: adc: ad_sigma_delta: Remove unused variable 'ret'

From: Jonathan Cameron <[email-masked]>
Date: Sat, 18 Jul 2020 15:24:39 +0100

On Thu, 16 Jul 2020 14:58:59 +0100
Lee Jones <[email-masked]> wrote:

> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/iio/adc/ad_sigma_delta.c: In function ‘ad_sd_trigger_handler’:
>  drivers/iio/adc/ad_sigma_delta.c:405:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
>  405 | int ret;
>  | ^~~
> 
> Cc: Michael Hennerich <[email-masked]>
> Signed-off-by: Lee Jones <[email-masked]>
Hi Lee,

My only thought on this one is perhaps we should put a warning in there
if ret isn't as expected.  Still never been one yet so I doubt anyone
minds too much.

Applied to the togreg branch of iio.git and pushed out as testing.
Note there is time for reviews from others before I push this out as
a non rebasing branch.  I'm also going to need to rebase it once
as previous pull hasn't quite gotten into staging/staging-next yet.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad_sigma_delta.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
> index dd3d54b3bc8bb..f269b926440da 100644
> --- a/drivers/iio/adc/ad_sigma_delta.c
> +++ b/drivers/iio/adc/ad_sigma_delta.c
> @@ -402,7 +402,6 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
>  	unsigned int reg_size;
>  	unsigned int data_reg;
>  	uint8_t data[16];
> -	int ret;
>  
>  	memset(data, 0x00, 16);
>  
> @@ -419,14 +418,12 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
>  	case 4:
>  	case 2:
>  	case 1:
> -		ret = ad_sd_read_reg_raw(sigma_delta, data_reg, reg_size,
> -			&data[0]);
> +		ad_sd_read_reg_raw(sigma_delta, data_reg, reg_size, &data[0]);
>  		break;
>  	case 3:
>  		/* We store 24 bit samples in a 32 bit word. Keep the upper
>  		 * byte set to zero. */
> -		ret = ad_sd_read_reg_raw(sigma_delta, data_reg, reg_size,
> -			&data[1]);
> +		ad_sd_read_reg_raw(sigma_delta, data_reg, reg_size, &data[1]);
>  		break;
>  	}
>  

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel