Skip to contentSkip to conversation

usb: storage: sddr09: Remove a set-but-not-used variable

PATCH In review Augusto Mecking Caringi 2 participants 2 messages Jan 24, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: storage: sddr09: Remove a set-but-not-used variable

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;
                 ^
---
 drivers/usb/storage/sddr09.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/storage/sddr09.c +1 -3
index 3aeaa53..44f8ffc 100644
@@ -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) {
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 36 lines · Augusto Mecking Caringi

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;
                 ^
---
 drivers/usb/storage/sddr09.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/storage/sddr09.c +1 -2
index 3aeaa53..44f8ffc 100644
@@ -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);

drivers/usb/storage/sddr09.c sddr09_write_lba(struct us_data *us, unsigned int lba, · line 891

Quoted 7 lines
drivers/usb/storage/sddr09.c +0 -1
@@ -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) {