Skip to contentSkip to conversation

scsi:hosts.c Fix warning: variable 'rval' set but not used

PATCH In review Justin P. Mattock 3 participants 6 messages Jun 18, 2010 – Jun 19, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/5 scsi:hosts.c Fix warning: variable 'rval' set but not used

The below patch fixes a warning message generated by gcc 4.6.0
CC drivers/scsi/hosts.o
drivers/scsi/hosts.c: In function 'scsi_host_alloc':
drivers/scsi/hosts.c:328:6: warning: variable 'rval' set but not used

---
 drivers/scsi/hosts.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/hosts.c +2 -2
index 6660fa9..4cc99b7 100644
@@ -325,7 +325,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 {
 	struct Scsi_Host *shost;
 	gfp_t gfp_mask = GFP_KERNEL;
-	int rval;
 
 	if (sht->unchecked_isa_dma && privsize)
 		gfp_mask |= __GFP_DMA;
@@ -420,7 +419,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	shost->ehandler = kthread_run(scsi_error_handler, shost,
 			"scsi_eh_%d", shost->host_no);
 	if (IS_ERR(shost->ehandler)) {
-		rval = PTR_ERR(shost->ehandler);
+		printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n", 
+			shost->host_no, PTR_ERR(shost->ehandler));
 		goto fail_kfree;
 	}
 
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#1 lore raw
Quoted 4 lines · Justin P. Mattock

The below patch fixes a warning message generated by gcc 4.6.0
CC drivers/scsi/hosts.o
drivers/scsi/hosts.c: In function 'scsi_host_alloc':
drivers/scsi/hosts.c:328:6: warning: variable 'rval' set but not used

OK, patch looks fine now, thanks! But this isn't:

Quoted 1 line

You need to read Documentation/SubmittingPatches for the full story, but you can't just add signed-off-by; you need an explicit email from the person saying that ... plus, signoffs should follow the natural progression of the patch, so if it's your patch, and you send it to me, I'll add my signoff before I put it in the tree. This has a legal basis in the DCO (see SubmittinPatches). We're a lot looser on the various other tags, though.

Anyway, the above is more for future reference; I'll fix it up.

James

Quoted 28 lines
---
 drivers/scsi/hosts.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/hosts.c +2 -2
index 6660fa9..4cc99b7 100644
@@ -325,7 +325,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 {
 	struct Scsi_Host *shost;
 	gfp_t gfp_mask = GFP_KERNEL;
-	int rval;
 
 	if (sht->unchecked_isa_dma && privsize)
 		gfp_mask |= __GFP_DMA;
@@ -420,7 +419,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	shost->ehandler = kthread_run(scsi_error_handler, shost,
 			"scsi_eh_%d", shost->host_no);
 	if (IS_ERR(shost->ehandler)) {
-		rval = PTR_ERR(shost->ehandler);
+		printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n", 
+			shost->host_no, PTR_ERR(shost->ehandler));
 		goto fail_kfree;
 	}
 
#2 lore raw
Quoted 18 lines · James Bottomley
Quoted 4 lines · Justin P. Mattock

The below patch fixes a warning message generated by gcc 4.6.0
CC drivers/scsi/hosts.o
drivers/scsi/hosts.c: In function 'scsi_host_alloc':
drivers/scsi/hosts.c:328:6: warning: variable 'rval' set but not used

OK, patch looks fine now, thanks! But this isn't:

Quoted 1 line

You need to read Documentation/SubmittingPatches for the full story, but you can't just add signed-off-by; you need an explicit email from the person saying that ... plus, signoffs should follow the natural progression of the patch, so if it's your patch, and you send it to me, I'll add my signoff before I put it in the tree. This has a legal basis in the DCO (see SubmittinPatches). We're a lot looser on the various other tags, though.

Quoted 3 lines

Anyway, the above is more for future reference; I'll fix it up.

James

alright!! and Thanks for be patient with me...

Quoted 32 lines
Quoted 29 lines
---
  drivers/scsi/hosts.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/hosts.c +2 -2
index 6660fa9..4cc99b7 100644
@@ -325,7 +325,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
  {
  	struct Scsi_Host *shost;
  	gfp_t gfp_mask = GFP_KERNEL;
-	int rval;
 
  	if (sht->unchecked_isa_dma&&  privsize)
  		gfp_mask |= __GFP_DMA;
@@ -420,7 +419,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
  	shost->ehandler = kthread_run(scsi_error_handler, shost,
  			"scsi_eh_%d", shost->host_no);
  	if (IS_ERR(shost->ehandler)) {
-		rval = PTR_ERR(shost->ehandler);
+		printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n",
+			shost->host_no, PTR_ERR(shost->ehandler));
  		goto fail_kfree;
  	}
 
#3 lore raw
In reply to Justin P. Mattock

drivers/scsi/hosts.c struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · line 423

Quoted 7 lines · Justin P. Mattock
drivers/scsi/hosts.c +2 -1
@@ -420,7 +419,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	shost->ehandler = kthread_run(scsi_error_handler, shost,
 			"scsi_eh_%d", shost->host_no);
 	if (IS_ERR(shost->ehandler)) {
-		rval = PTR_ERR(shost->ehandler);
+		printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n", 
+			shost->host_no, PTR_ERR(shost->ehandler));

Surely this should simply be:

		shost_printk(KERN_WARNING, shost, "error handler thread failed"
				"to spawn (%ld)\n", PTR_ERR(shost->ehandler));
Quoted 10 lines
drivers/scsi/hosts.c +0 -0
 		goto fail_kfree;
 	}
 
Signature · 6 lines
1.7.1.rc1.21.gf3bd6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#4 lore raw
Quoted 11 lines · Matthew Wilcox

drivers/scsi/hosts.c struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · line 423

Quoted 7 lines · Justin P. Mattock
drivers/scsi/hosts.c +2 -1
@@ -420,7 +419,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
  	shost->ehandler = kthread_run(scsi_error_handler, shost,
  			"scsi_eh_%d", shost->host_no);
  	if (IS_ERR(shost->ehandler)) {
-		rval = PTR_ERR(shost->ehandler);
+		printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n",
+			shost->host_no, PTR_ERR(shost->ehandler));

Surely this should simply be:

Quoted 14 lines
		shost_printk(KERN_WARNING, shost, "error handler thread failed"
				"to spawn (%ld)\n", PTR_ERR(shost->ehandler));
Quoted 10 lines
drivers/scsi/hosts.c +0 -1
  		goto fail_kfree;
  	}
 
--

1.7.1.rc1.21.gf3bd6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

the above change goes through without a warning message.. should I resend?

Justin P. Mattock

#5 lore raw
In reply to Matthew Wilcox
Quoted 11 lines · Matthew Wilcox

drivers/scsi/hosts.c struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · line 423

Quoted 7 lines · Justin P. Mattock
drivers/scsi/hosts.c +2 -1
@@ -420,7 +419,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	shost->ehandler = kthread_run(scsi_error_handler, shost,
 			"scsi_eh_%d", shost->host_no);
 	if (IS_ERR(shost->ehandler)) {
-		rval = PTR_ERR(shost->ehandler);
+		printk(KERN_WARNING "scsi%d: error handler thread failed to spawn, error = %ld\n", 
+			shost->host_no, PTR_ERR(shost->ehandler));

Surely this should simply be:

Quoted 2 lines
		shost_printk(KERN_WARNING, shost, "error handler thread failed"
				"to spawn (%ld)\n", PTR_ERR(shost->ehandler));

Actually, I'm wary of doing this: the device isn't fully initialised (it's unparented and not added to the system) so that could cause problems down the road for intelligent error gathering. It's why we tend to do the printk scsi%d (or dev_printk on the parent) thing up until scsi_host_add().

James