aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ide-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r--drivers/scsi/ide-scsi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index b40a673985aa..461331d3dc45 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -102,11 +102,10 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
102 mutex_lock(&idescsi_ref_mutex); 102 mutex_lock(&idescsi_ref_mutex);
103 scsi = ide_scsi_g(disk); 103 scsi = ide_scsi_g(disk);
104 if (scsi) { 104 if (scsi) {
105 scsi_host_get(scsi->host); 105 if (ide_device_get(scsi->drive))
106 if (ide_device_get(scsi->drive)) {
107 scsi_host_put(scsi->host);
108 scsi = NULL; 106 scsi = NULL;
109 } 107 else
108 scsi_host_get(scsi->host);
110 } 109 }
111 mutex_unlock(&idescsi_ref_mutex); 110 mutex_unlock(&idescsi_ref_mutex);
112 return scsi; 111 return scsi;
@@ -114,9 +113,11 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
114 113
115static void ide_scsi_put(struct ide_scsi_obj *scsi) 114static void ide_scsi_put(struct ide_scsi_obj *scsi)
116{ 115{
116 ide_drive_t *drive = scsi->drive;
117
117 mutex_lock(&idescsi_ref_mutex); 118 mutex_lock(&idescsi_ref_mutex);
118 ide_device_put(scsi->drive);
119 scsi_host_put(scsi->host); 119 scsi_host_put(scsi->host);
120 ide_device_put(drive);
120 mutex_unlock(&idescsi_ref_mutex); 121 mutex_unlock(&idescsi_ref_mutex);
121} 122}
122 123