diff --git a/[refs] b/[refs] index edfd6f3a9595..e3d762fd2888 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 884d25cc4fda20908fd4ef93dbb41d817984b68b +refs/heads/master: f479ab87936563a286b8aa0e39003c40fa31c6da diff --git a/trunk/drivers/scsi/scsi.c b/trunk/drivers/scsi/scsi.c index eedfd059b82b..c35f5fc0d668 100644 --- a/trunk/drivers/scsi/scsi.c +++ b/trunk/drivers/scsi/scsi.c @@ -873,10 +873,12 @@ EXPORT_SYMBOL(scsi_device_get); */ void scsi_device_put(struct scsi_device *sdev) { + struct module *module = sdev->host->hostt->module; + /* The module refcount will be zero if scsi_device_get() * was called from a module removal routine */ - if (likely(module_refcount(sdev->host->hostt->module) != 0)) - module_put(sdev->host->hostt->module); + if (module && module_refcount(module) != 0) + module_put(module); put_device(&sdev->sdev_gendev); } EXPORT_SYMBOL(scsi_device_put);