Skip to contentSkip to conversation

keucr: restored lost line

PATCH In review Laura Lawniczak 4 participants 7 messages Jun 6, 2013 – Jun 9, 2013 1 message not in the archive Staging

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

cover keucr: remove unused variable warning

Hi,

this will remove the unused variable warning caused by previous patch series.

regards,
Laura Lawniczak

Laura Lawniczak (1):
keucr: restored lost line

 drivers/staging/keucr/transport.c |    1 +
 1 file changed, 1 insertion(+)
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/1 keucr: restored lost line

This line was unfortunately removed during patch process. This caused an "unused variable" warning and may cause other unintended effects. So here it is again.

---
 drivers/staging/keucr/transport.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/keucr/transport.c +1 -0
index 1f9ea58..c47a035 100644
@@ -131,6 +131,7 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 		break;
 	}
 	bn = 0;
+	blen = 0;
 }
 
 /*
Signature · 1 line
1.7.10.4
#3 lore raw
Quoted 4 lines · Laura Lawniczak

This line was unfortunately removed during patch process. This caused an "unused variable" warning and may cause other unintended effects. So here it is again.

Oh wow... I noticed this in the first patch and I couldn't figure out why the blen = 0 was there... It never occurred to me that it was to silence the warning. :P That's hilarious.

The blen variable is only used in commented out code. Don't do this. Please delete everything to do with blen. It's there in the history if anyone wants to see it. Delete "bn" as well.

regards,
dan carpenter

maintainer
#4 lore raw
In reply to Laura Lawniczak
Quoted 14 lines · Laura Lawniczak

This line was unfortunately removed during patch process. This caused an "unused variable" warning and may cause other unintended effects. So here it is again.

---
 drivers/staging/keucr/transport.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/keucr/transport.c +0 -0
index 1f9ea58..c47a035 100644

drivers/staging/keucr/transport.c static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb) · line 134

Quoted 4 lines
drivers/staging/keucr/transport.c +1 -0
@@ -131,6 +131,7 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 		break;
 	}
 	bn = 0;
+	blen = 0;

Really? If it's unused, why do you want to set it to something? Any why is bn set to 0 at the end of the function as well?

Shouldn't both of these lines be removed, and the variable itself removed too?

thanks,

greg k-h

#5 lore raw

PATCH 1/1 keucr: removed unnecessary variables and comments

blen and bn were only used in commented code fragments. since comments should be informative and not for storing old code, both, commented code and variables, were removed.

---
 drivers/staging/keucr/transport.c |   15 ---------------
 1 file changed, 15 deletions(-)
drivers/staging/keucr/transport.c +0 -15
index c47a035..aeb2186 100644
@@ -85,16 +85,9 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 {
 	PBYTE   Cdb = srb->cmnd;
 	DWORD   cmd = Cdb[0];
-	DWORD   bn  =   ((Cdb[2] << 24) & 0xff000000) |
-			((Cdb[3] << 16) & 0x00ff0000) |
-			((Cdb[4] << 8) & 0x0000ff00) |
-			((Cdb[5] << 0) & 0x000000ff);
-	WORD    blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff);
 
 	switch (cmd) {
 	case TEST_UNIT_READY:
-		/* dev_dbg(&us->pusb_dev->dev,
-			"scsi cmd %X --- SCSIOP_TEST_UNIT_READY\n", cmd); */
 		break;
 	case INQUIRY:
 		dev_dbg(&us->pusb_dev->dev,
@@ -113,14 +106,8 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 				"scsi cmd %X --- SCSIOP_READ_CAPACITY\n", cmd);
 		break;
 	case READ_10:
-		/*  dev_dbg(&us->pusb_dev->dev,
-			"scsi cmd %X --- SCSIOP_READ,bn = %X, blen = %X\n"
-			cmd, bn, blen); */
 		break;
 	case WRITE_10:
-		/* dev_dbg(&us->pusb_dev->dev,
-			"scsi cmd %X --- SCSIOP_WRITE, bn = %X, blen = %X\n",
-			cmd, bn, blen); */
 		break;
 	case ALLOW_MEDIUM_REMOVAL:
 		dev_dbg(&us->pusb_dev->dev,
@@ -130,8 +117,6 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 		dev_dbg(&us->pusb_dev->dev, "scsi cmd %X --- Other cmd\n", cmd);
 		break;
 	}
-	bn = 0;
-	blen = 0;
 }
 
 /*
Signature · 1 line
1.7.10.4
maintainer
#6 lore raw

Re: [PATCH] keucr: removed unnecessary variables and comments

Quoted 9 lines · Laura Lawniczak

blen and bn were only used in commented code fragments. since comments should be informative and not for storing old code, both, commented code and variables, were removed.

---
 drivers/staging/keucr/transport.c |   15 ---------------
 1 file changed, 15 deletions(-)

This patch doesn't apply to my tree, can you please redo it against my latest tree and resend it?

thanks,

greg k-h

#7 lore raw

PATCH 1/1 keucr: removed unnecessary variables and comments

From: Laura Lawniczak <[email protected]>

blen and bn were only used in commented code fragments. since comments should be informative and not for storing old code, both, commented code and variables, were removed.

---

this one is against latest gregkh/staging-next, and at least for me applies cleanly.

 drivers/staging/keucr/transport.c |   14 --------------
 1 file changed, 14 deletions(-)
drivers/staging/keucr/transport.c +0 -14
index 1f9ea58..aeb2186 100644
@@ -85,16 +85,9 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 {
 	PBYTE   Cdb = srb->cmnd;
 	DWORD   cmd = Cdb[0];
-	DWORD   bn  =   ((Cdb[2] << 24) & 0xff000000) |
-			((Cdb[3] << 16) & 0x00ff0000) |
-			((Cdb[4] << 8) & 0x0000ff00) |
-			((Cdb[5] << 0) & 0x000000ff);
-	WORD    blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff);
 
 	switch (cmd) {
 	case TEST_UNIT_READY:
-		/* dev_dbg(&us->pusb_dev->dev,
-			"scsi cmd %X --- SCSIOP_TEST_UNIT_READY\n", cmd); */
 		break;
 	case INQUIRY:
 		dev_dbg(&us->pusb_dev->dev,
@@ -113,14 +106,8 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 				"scsi cmd %X --- SCSIOP_READ_CAPACITY\n", cmd);
 		break;
 	case READ_10:
-		/*  dev_dbg(&us->pusb_dev->dev,
-			"scsi cmd %X --- SCSIOP_READ,bn = %X, blen = %X\n"
-			cmd, bn, blen); */
 		break;
 	case WRITE_10:
-		/* dev_dbg(&us->pusb_dev->dev,
-			"scsi cmd %X --- SCSIOP_WRITE, bn = %X, blen = %X\n",
-			cmd, bn, blen); */
 		break;
 	case ALLOW_MEDIUM_REMOVAL:
 		dev_dbg(&us->pusb_dev->dev,
@@ -130,7 +117,6 @@ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb)
 		dev_dbg(&us->pusb_dev->dev, "scsi cmd %X --- Other cmd\n", cmd);
 		break;
 	}
-	bn = 0;
 }
 
 /*
Signature · 1 line
1.7.10.4