Signed-off-by: Christoph Hellwig <h...@lst.de>
---
 drivers/scsi/scsi_error.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 78b004d..f8b54c1 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2289,6 +2289,11 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
                return FAILED;
 
        scmd = scsi_get_command(dev, GFP_KERNEL);
+       if (!scmd) {
+               rtn = FAILED;
+               goto out_put_autopm_host;
+       }
+
        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;
 }
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to