diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index c35f5fc0d66800aa185e634252c3930b528dd242..c51b5769eac82790331bc9013ee6e571b2536d84 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -875,10 +875,12 @@ void scsi_device_put(struct scsi_device *sdev)
 {
 	struct module *module = sdev->host->hostt->module;
 
+#ifdef CONFIG_MODULE_UNLOAD
 	/* The module refcount will be zero if scsi_device_get()
 	 * was called from a module removal routine */
 	if (module && module_refcount(module) != 0)
 		module_put(module);
+#endif
 	put_device(&sdev->sdev_gendev);
 }
 EXPORT_SYMBOL(scsi_device_put);