summaryrefslogtreecommitdiff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorSubhash Jadavani <subhashj@codeaurora.org>2015-08-13 16:58:03 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:01:00 -0700
commit4c8c56c5d16955f69c8449ded9222465668cd83b (patch)
treef1c004db6244a69213c7e21cb27d72e2a00d6a01 /drivers/scsi/sd.c
parent628aaf1ba9b1c99fce40a0a3b958201024884597 (diff)
scsi: sd: add null pointer check for scsi disk pointer
scsi disk driver probe first calls the PM runtime get before actually allocating the scsi disk structure and if the PM runtime status was set to suspended at this time then it will trigger scsi disk driver's resume callback. But scsi disk driver's resume callback assumes that scsi disk structure is always available when it is called but that's not true always. Fix this issue by skipping the scsi disk resume if scsi disk structure isn't allocated. Change-Id: Ica920b1e07976140dc29847f4dc61aac9fa402ae Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ffcbe2e89e97..8865327f1ffb 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3311,6 +3311,9 @@ static int sd_resume(struct device *dev)
{
struct scsi_disk *sdkp = dev_get_drvdata(dev);
+ if (!sdkp)
+ return 0; /* this can happen */
+
if (!sdkp->device->manage_start_stop)
return 0;