diff options
author | Christoph Hellwig <hch@infradead.org> | 2014-02-20 17:20:55 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:19:24 -0400 |
commit | 0479633686d370303e3430256ace4bd5f7f138dc (patch) | |
tree | 8315562a82e4c64712d2d8ee423be2f346aa27c5 /drivers/scsi/scsi_error.c | |
parent | 21a05df547dd0ac532d3a89e241dc504018eb881 (diff) |
[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) | |||
2288 | if (scsi_autopm_get_host(shost) < 0) | 2288 | if (scsi_autopm_get_host(shost) < 0) |
2289 | return FAILED; | 2289 | return FAILED; |
2290 | 2290 | ||
2291 | if (!get_device(&dev->sdev_gendev)) { | ||
2292 | rtn = FAILED; | ||
2293 | goto out_put_autopm_host; | ||
2294 | } | ||
2295 | |||
2291 | scmd = scsi_get_command(dev, GFP_KERNEL); | 2296 | scmd = scsi_get_command(dev, GFP_KERNEL); |
2292 | blk_rq_init(NULL, &req); | 2297 | blk_rq_init(NULL, &req); |
2293 | scmd->request = &req; | 2298 | scmd->request = &req; |
@@ -2345,6 +2350,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
2345 | scsi_run_host_queues(shost); | 2350 | scsi_run_host_queues(shost); |
2346 | 2351 | ||
2347 | scsi_next_command(scmd); | 2352 | scsi_next_command(scmd); |
2353 | out_put_autopm_host: | ||
2348 | scsi_autopm_put_host(shost); | 2354 | scsi_autopm_put_host(shost); |
2349 | return rtn; | 2355 | return rtn; |
2350 | } | 2356 | } |