[PATCH] i2o_dump_hrt() output cleanup
[safe/jmp/linux-2.6] / drivers / scsi / scsi_scan.c
index 5d4ca87..f149459 100644 (file)
@@ -288,10 +288,7 @@ static void scsi_target_dev_release(struct device *dev)
 {
        struct device *parent = dev->parent;
        struct scsi_target *starget = to_scsi_target(dev);
-       struct Scsi_Host *shost = dev_to_shost(parent);
 
-       if (shost->hostt->target_destroy)
-               shost->hostt->target_destroy(starget);
        kfree(starget);
        put_device(parent);
 }
@@ -416,6 +413,8 @@ static void scsi_target_reap_usercontext(void *data)
        device_del(&starget->dev);
        transport_destroy_device(&starget->dev);
        spin_lock_irqsave(shost->host_lock, flags);
+       if (shost->hostt->target_destroy)
+               shost->hostt->target_destroy(starget);
        list_del_init(&starget->siblings);
        spin_unlock_irqrestore(shost->host_lock, flags);
        put_device(&starget->dev);
@@ -775,8 +774,20 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
 
        transport_configure_device(&sdev->sdev_gendev);
 
-       if (sdev->host->hostt->slave_configure)
-               sdev->host->hostt->slave_configure(sdev);
+       if (sdev->host->hostt->slave_configure) {
+               int ret = sdev->host->hostt->slave_configure(sdev);
+               if (ret) {
+                       /*
+                        * if LLDD reports slave not present, don't clutter
+                        * console with alloc failure messages
+                        */
+                       if (ret != -ENXIO) {
+                               sdev_printk(KERN_ERR, sdev,
+                                       "failed to configure device\n");
+                       }
+                       return SCSI_SCAN_NO_RESPONSE;
+               }
+       }
 
        /*
         * Ok, the device is now all set up, we can