aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 20ad59dff730..76ee2e784f75 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -964,10 +964,11 @@ static void __scsi_remove_target(struct scsi_target *starget)
964 list_for_each_entry(sdev, &shost->__devices, siblings) { 964 list_for_each_entry(sdev, &shost->__devices, siblings) {
965 if (sdev->channel != starget->channel || 965 if (sdev->channel != starget->channel ||
966 sdev->id != starget->id || 966 sdev->id != starget->id ||
967 sdev->sdev_state == SDEV_DEL) 967 scsi_device_get(sdev))
968 continue; 968 continue;
969 spin_unlock_irqrestore(shost->host_lock, flags); 969 spin_unlock_irqrestore(shost->host_lock, flags);
970 scsi_remove_device(sdev); 970 scsi_remove_device(sdev);
971 scsi_device_put(sdev);
971 spin_lock_irqsave(shost->host_lock, flags); 972 spin_lock_irqsave(shost->host_lock, flags);
972 goto restart; 973 goto restart;
973 } 974 }