lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 7 Jan 2024 16:02:32 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <david@...hnology.com>
Cc: Colin Ian King <colin.i.king@...il.com>, Lars-Peter Clausen
 <lars@...afoo.de>, linux-iio@...r.kernel.org,
 kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] iio: adc: ti-ads7950: remove redundant assignment
 to variable ret

On Sat, 6 Jan 2024 12:14:22 -0600
David Lechner <david@...hnology.com> wrote:

> On 1/6/24 9:22 AM, Colin Ian King wrote:
> > Variable ret is being assigned a value that is never read, the variable
> > is being re-assigned again a few statements later. Remove it.
> > 
> > Cleans up clang scan build warning:
> > warning: Value stored to 'ret' is never read [deadcode.DeadStores]
> > 
> > Signed-off-by: Colin Ian King <colin.i.king@...il.com>
> > ---
> >   drivers/iio/adc/ti-ads7950.c | 2 --
> >   1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
> > index 263fc3a1b87e..f975de059ba0 100644
> > --- a/drivers/iio/adc/ti-ads7950.c
> > +++ b/drivers/iio/adc/ti-ads7950.c
> > @@ -441,8 +441,6 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)
> >   	if (ret)
> >   		goto out;
> >   
> > -	ret = ((st->single_rx >> 12) & BIT(offset)) ? 1 : 0;
> > -
> >   	/* Revert back to original settings */
> >   	st->cmd_settings_bitmask &= ~TI_ADS7950_CR_GPIO_DATA;
> >   	st->single_tx = TI_ADS7950_MAN_CMD_SETTINGS(st);  
> 
> This does not look like the correct fix. This is the intended return value of the function in the case of no errors. So we probably need to introduce a new variable instead so that it doesn't get written over.

Agreed.  Needs to stash that in another local variable and return that value
if ret == 0.

J


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ