aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index c44783801402..47291bcff0d5 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
317out_device_destroy: 317out_device_destroy:
318 scsi_device_set_state(sdev, SDEV_DEL); 318 scsi_device_set_state(sdev, SDEV_DEL);
319 transport_destroy_device(&sdev->sdev_gendev); 319 transport_destroy_device(&sdev->sdev_gendev);
320 put_device(&sdev->sdev_dev);
320 put_device(&sdev->sdev_gendev); 321 put_device(&sdev->sdev_gendev);
321out: 322out:
322 if (display_failure_msg) 323 if (display_failure_msg)
@@ -951,15 +952,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
951 return SCSI_SCAN_LUN_PRESENT; 952 return SCSI_SCAN_LUN_PRESENT;
952} 953}
953 954
954static inline void scsi_destroy_sdev(struct scsi_device *sdev)
955{
956 scsi_device_set_state(sdev, SDEV_DEL);
957 if (sdev->host->hostt->slave_destroy)
958 sdev->host->hostt->slave_destroy(sdev);
959 transport_destroy_device(&sdev->sdev_gendev);
960 put_device(&sdev->sdev_gendev);
961}
962
963#ifdef CONFIG_SCSI_LOGGING 955#ifdef CONFIG_SCSI_LOGGING
964/** 956/**
965 * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace 957 * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace
@@ -1137,7 +1129,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
1137 } 1129 }
1138 } 1130 }
1139 } else 1131 } else
1140 scsi_destroy_sdev(sdev); 1132 __scsi_remove_device(sdev);
1141 out: 1133 out:
1142 return res; 1134 return res;
1143} 1135}
@@ -1498,7 +1490,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1498 /* 1490 /*
1499 * the sdev we used didn't appear in the report luns scan 1491 * the sdev we used didn't appear in the report luns scan
1500 */ 1492 */
1501 scsi_destroy_sdev(sdev); 1493 __scsi_remove_device(sdev);
1502 return ret; 1494 return ret;
1503} 1495}
1504 1496
@@ -1708,7 +1700,7 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
1708 shost_for_each_device(sdev, shost) { 1700 shost_for_each_device(sdev, shost) {
1709 if (!scsi_host_scan_allowed(shost) || 1701 if (!scsi_host_scan_allowed(shost) ||
1710 scsi_sysfs_add_sdev(sdev) != 0) 1702 scsi_sysfs_add_sdev(sdev) != 0)
1711 scsi_destroy_sdev(sdev); 1703 __scsi_remove_device(sdev);
1712 } 1704 }
1713} 1705}
1714 1706
@@ -1941,7 +1933,7 @@ void scsi_free_host_dev(struct scsi_device *sdev)
1941{ 1933{
1942 BUG_ON(sdev->id != sdev->host->this_id); 1934 BUG_ON(sdev->id != sdev->host->this_id);
1943 1935
1944 scsi_destroy_sdev(sdev); 1936 __scsi_remove_device(sdev);
1945} 1937}
1946EXPORT_SYMBOL(scsi_free_host_dev); 1938EXPORT_SYMBOL(scsi_free_host_dev);
1947 1939