mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: storage: sddr09: Remove a set-but-not-used variable
@ 2017-01-24 18:11 Augusto Mecking Caringi
  2017-01-24 20:12 ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Augusto Mecking Caringi @ 2017-01-24 18:11 UTC (permalink / raw)
  To: Alan Stern
  Cc: Augusto Mecking Caringi, Greg Kroah-Hartman, linux-usb,
	usb-storage, linux-kernel

The 'isnew' variable in 'sddr09_write_lba' function is set but never
used.

This has been detected by building the driver with W=1:

drivers/usb/storage/sddr09.c: In function ‘sddr09_write_lba’:
drivers/usb/storage/sddr09.c:873:17: warning: variable ‘isnew’ set but
not used [-Wunused-but-set-variable]
int i, result, isnew;
                 ^

Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
---
 drivers/usb/storage/sddr09.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index 3aeaa53..44f8ffc 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -870,13 +870,12 @@ sddr09_write_lba(struct us_data *us, unsigned int lba,
 	unsigned int pagelen;
 	unsigned char *bptr, *cptr, *xptr;
 	unsigned char ecc[3];
-	int i, result, isnew;
+	int i, result;
 
 	lbap = ((lba % 1000) << 1) | 0x1000;
 	if (parity[MSB_of(lbap) ^ LSB_of(lbap)])
 		lbap ^= 1;
 	pba = info->lba_to_pba[lba];
-	isnew = 0;
 
 	if (pba == UNDEF) {
 		pba = sddr09_find_unused_pba(info, lba);
@@ -887,7 +886,6 @@ sddr09_write_lba(struct us_data *us, unsigned int lba,
 		}
 		info->pba_to_lba[pba] = lba;
 		info->lba_to_pba[lba] = pba;
-		isnew = 1;
 	}
 
 	if (pba == 1) {
-- 
2.7.4

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

* Re: [PATCH] usb: storage: sddr09: Remove a set-but-not-used variable
  2017-01-24 18:11 [PATCH] usb: storage: sddr09: Remove a set-but-not-used variable Augusto Mecking Caringi
@ 2017-01-24 20:12 ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2017-01-24 20:12 UTC (permalink / raw)
  To: Augusto Mecking Caringi
  Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel

On Tue, 24 Jan 2017, Augusto Mecking Caringi wrote:

> The 'isnew' variable in 'sddr09_write_lba' function is set but never
> used.
> 
> This has been detected by building the driver with W=1:
> 
> drivers/usb/storage/sddr09.c: In function ‘sddr09_write_lba’:
> drivers/usb/storage/sddr09.c:873:17: warning: variable ‘isnew’ set but
> not used [-Wunused-but-set-variable]
> int i, result, isnew;
>                  ^
> 
> Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
> ---
>  drivers/usb/storage/sddr09.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
> index 3aeaa53..44f8ffc 100644
> --- a/drivers/usb/storage/sddr09.c
> +++ b/drivers/usb/storage/sddr09.c
> @@ -870,13 +870,12 @@ sddr09_write_lba(struct us_data *us, unsigned int lba,
>  	unsigned int pagelen;
>  	unsigned char *bptr, *cptr, *xptr;
>  	unsigned char ecc[3];
> -	int i, result, isnew;
> +	int i, result;
>  
>  	lbap = ((lba % 1000) << 1) | 0x1000;
>  	if (parity[MSB_of(lbap) ^ LSB_of(lbap)])
>  		lbap ^= 1;
>  	pba = info->lba_to_pba[lba];
> -	isnew = 0;
>  
>  	if (pba == UNDEF) {
>  		pba = sddr09_find_unused_pba(info, lba);
> @@ -887,7 +886,6 @@ sddr09_write_lba(struct us_data *us, unsigned int lba,
>  		}
>  		info->pba_to_lba[pba] = lba;
>  		info->lba_to_pba[lba] = pba;
> -		isnew = 1;
>  	}
>  
>  	if (pba == 1) {

Acked-by: Alan Stern <stern@rowland.harvard.edu>

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

end of thread, other threads:[~2017-01-24 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 18:11 [PATCH] usb: storage: sddr09: Remove a set-but-not-used variable Augusto Mecking Caringi
2017-01-24 20:12 ` Alan Stern

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®