linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi core: fix uninitialized variable error
@ 2006-02-02 21:44 Alan Stern
  2006-02-05 15:01 ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2006-02-02 21:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI development list

James:

This patch (as649) fixes an uninitialized variable error (sdev) in 
__scsi_add_device.  I don't understand why the compiler didn't flag the 
error.

It also removes a pair of calls to get_device and put_device; they are no 
longer needed since scsi_target_reap now uses a work_queue.

Alan Stern



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

---

Index: usb-2.6/drivers/scsi/scsi_scan.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi_scan.c
+++ usb-2.6/drivers/scsi/scsi_scan.c
@@ -368,11 +368,7 @@ static struct scsi_target *scsi_alloc_ta
 
 		if(error) {
 			dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error);
-			/* don't want scsi_target_reap to do the final
-			 * put because it will be under the host lock */
-			get_device(dev);
 			scsi_target_reap(starget);
-			put_device(dev);
 			return NULL;
 		}
 	}
@@ -1265,7 +1261,6 @@ struct scsi_device *__scsi_add_device(st
 {
 	struct scsi_device *sdev;
 	struct device *parent = &shost->shost_gendev;
-	int res;
 	struct scsi_target *starget;
 
 	starget = scsi_alloc_target(parent, channel, id);
@@ -1274,12 +1269,10 @@ struct scsi_device *__scsi_add_device(st
 
 	get_device(&starget->dev);
 	mutex_lock(&shost->scan_mutex);
-	if (scsi_host_scan_allowed(shost)) {
-		res = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1,
-					     hostdata);
-		if (res != SCSI_SCAN_LUN_PRESENT)
-			sdev = ERR_PTR(-ENODEV);
-	}
+	if (!scsi_host_scan_allowed(shost) ||
+			scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1,
+				hostdata) != SCSI_SCAN_LUN_PRESENT)
+		sdev = ERR_PTR(-ENODEV);
 	mutex_unlock(&shost->scan_mutex);
 	scsi_target_reap(starget);
 	put_device(&starget->dev);


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

end of thread, other threads:[~2006-02-06  8:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-02 21:44 [PATCH] scsi core: fix uninitialized variable error Alan Stern
2006-02-05 15:01 ` Matthew Wilcox
2006-02-05 16:11   ` Alan Stern
2006-02-05 21:30     ` Matthew Wilcox
2006-02-05 21:45       ` Alan Stern
2006-02-06  8:42       ` Markus Lidel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).