diff options
author | Christoph Hellwig <hch@infradead.org> | 2014-02-20 14:20:55 -0800 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 10:19:24 -0700 |
commit | 0479633686d370303e3430256ace4bd5f7f138dc (patch) | |
tree | 8315562a82e4c64712d2d8ee423be2f346aa27c5 /drivers/scsi/scsi_error.c | |
parent | 21a05df547dd0ac532d3a89e241dc504018eb881 (diff) | |
download | lwn-0479633686d370303e3430256ace4bd5f7f138dc.tar.gz lwn-0479633686d370303e3430256ace4bd5f7f138dc.zip |
[SCSI] do not manipulate device reference counts in scsi_get/put_command
Many callers won't need this and we can optimize them away. In addition
the handling in the __-prefixed variants was inconsistant to start with.
Based on an earlier patch from Bart Van Assche.
[jejb: fix kerneldoc probelm picked up by Fengguang Wu]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r-- | drivers/scsi/scsi_error.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 78b004da2885..771c16bfdbac 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -2288,6 +2288,11 @@ scsi_reset_provider(struct scsi_device *dev, int flag) if (scsi_autopm_get_host(shost) < 0) return FAILED; + if (!get_device(&dev->sdev_gendev)) { + rtn = FAILED; + goto out_put_autopm_host; + } + scmd = scsi_get_command(dev, GFP_KERNEL); blk_rq_init(NULL, &req); scmd->request = &req; @@ -2345,6 +2350,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag) scsi_run_host_queues(shost); scsi_next_command(scmd); +out_put_autopm_host: scsi_autopm_put_host(shost); return rtn; } |