]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blobdiff - drivers/scsi/sd.c
Merge tag 'for-5.16/block-2021-10-29' of git://git.kernel.dk/linux-block
[mirror_ubuntu-kernels.git] / drivers / scsi / sd.c
index 523bf2fdc25321e3444e04b6ab4f33fffb14041c..9bdee968d3b57d3acb31e00c673d9dd1d8437b52 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/blkpg.h>
 #include <linux/blk-pm.h>
 #include <linux/delay.h>
+#include <linux/major.h>
 #include <linux/mutex.h>
 #include <linux/string_helpers.h>
 #include <linux/async.h>
@@ -3683,7 +3684,12 @@ static int sd_resume(struct device *dev)
 static int sd_resume_runtime(struct device *dev)
 {
        struct scsi_disk *sdkp = dev_get_drvdata(dev);
-       struct scsi_device *sdp = sdkp->device;
+       struct scsi_device *sdp;
+
+       if (!sdkp)      /* E.g.: runtime resume at the start of sd_probe() */
+               return 0;
+
+       sdp = sdkp->device;
 
        if (sdp->ignore_media_change) {
                /* clear the device's sense data */