mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] comedi: remove redundant assignment to variable range
@ 2024-02-05 18:04 Colin Ian King
  2024-02-06 12:19 ` Ian Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-02-05 18:04 UTC (permalink / raw)
  To: Ian Abbott, H Hartley Sweeten, Greg Kroah-Hartman
  Cc: kernel-janitors, linux-kernel

The variable range is being initialized with a value that is never
read, it is being re-assigned later on. The initialization is
redundant and can be removed.

Cleans up clang scan build warning:
drivers/comedi/drivers/das08.c:180:2: warning: Value stored
to 'range' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/comedi/drivers/das08.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/comedi/drivers/das08.c b/drivers/comedi/drivers/das08.c
index 5d5b9174f88a..49944ce1f813 100644
--- a/drivers/comedi/drivers/das08.c
+++ b/drivers/comedi/drivers/das08.c
@@ -177,7 +177,6 @@ static int das08_ai_insn_read(struct comedi_device *dev,
 	int ret;
 
 	chan = CR_CHAN(insn->chanspec);
-	range = CR_RANGE(insn->chanspec);
 
 	/* clear crap */
 	inb(dev->iobase + DAS08_AI_LSB_REG);
-- 
2.39.2


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

* Re: [PATCH][next] comedi: remove redundant assignment to variable range
  2024-02-05 18:04 [PATCH][next] comedi: remove redundant assignment to variable range Colin Ian King
@ 2024-02-06 12:19 ` Ian Abbott
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Abbott @ 2024-02-06 12:19 UTC (permalink / raw)
  To: Colin Ian King, H Hartley Sweeten, Greg Kroah-Hartman
  Cc: kernel-janitors, linux-kernel

On 05/02/2024 18:04, Colin Ian King wrote:
> The variable range is being initialized with a value that is never
> read, it is being re-assigned later on. The initialization is
> redundant and can be removed.
> 
> Cleans up clang scan build warning:
> drivers/comedi/drivers/das08.c:180:2: warning: Value stored
> to 'range' is never read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>   drivers/comedi/drivers/das08.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/comedi/drivers/das08.c b/drivers/comedi/drivers/das08.c
> index 5d5b9174f88a..49944ce1f813 100644
> --- a/drivers/comedi/drivers/das08.c
> +++ b/drivers/comedi/drivers/das08.c
> @@ -177,7 +177,6 @@ static int das08_ai_insn_read(struct comedi_device *dev,
>   	int ret;
>   
>   	chan = CR_CHAN(insn->chanspec);
> -	range = CR_RANGE(insn->chanspec);
>   
>   	/* clear crap */
>   	inb(dev->iobase + DAS08_AI_LSB_REG);

Thanks.  It looks like it gets reassigned to the same value further 
down, closer to the point where the value is used (within an `if` 
block), and so it doesn't matter which of the assignments is removed.

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-


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

end of thread, other threads:[~2024-02-06 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 18:04 [PATCH][next] comedi: remove redundant assignment to variable range Colin Ian King
2024-02-06 12:19 ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®