diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-30 00:14:45 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-30 00:14:45 +0300 |
commit | a12883f0af7a4ccc74381395fab5912784183efe (patch) | |
tree | 0a7cb3cec4d42260f35ec4fa62d2c5b0ba5e9bdb /drivers/scsi/sr.c | |
parent | 13d569900792fdc3a46dda48d1d2bf46febdc0bc (diff) | |
parent | 6344a5cd3e8acf6e9823046cebd00b16faacdb1a (diff) | |
download | linux-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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 8bd54a64efd6..64c867405ad4 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); |