summaryrefslogtreecommitdiff
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-29 21:14:45 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-29 21:14:45 (GMT)
commita12883f0af7a4ccc74381395fab5912784183efe (patch)
tree0a7cb3cec4d42260f35ec4fa62d2c5b0ba5e9bdb /drivers/scsi/sr.c
parent13d569900792fdc3a46dda48d1d2bf46febdc0bc (diff)
parent6344a5cd3e8acf6e9823046cebd00b16faacdb1a (diff)
downloadlinux-a12883f0af7a4ccc74381395fab5912784183efe.tar.xz
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Four fixes: one to try to fix our repeated intermittent crashes in suspend/resume, one to correct a regression in the optimal I/O size reporting and a couple for randconfig build failures in the hisi_sas driver" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: SCSI: fix crashes in sd and sr runtime PM sd: Optimal I/O size is in bytes, not sectors hisi_sas: Restrict SCSI_HISI_SAS to arm64 hisi_sas: SCSI_HISI_SAS should depend on HAS_DMA
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 8bd54a6..64c8674 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct device *dev)
{
struct scsi_cd *cd = dev_get_drvdata(dev);
+ if (!cd) /* E.g.: runtime suspend following sr_remove() */
+ return 0;
+
if (cd->media_present)
return -EBUSY;
else
@@ -985,6 +988,7 @@ static int sr_remove(struct device *dev)
scsi_autopm_get_device(cd->device);
del_gendisk(cd->disk);
+ dev_set_drvdata(dev, NULL);
mutex_lock(&sr_ref_mutex);
kref_put(&cd->kref, sr_kref_release);