Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f479ab87 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley
Browse files

[SCSI] fix up non-modular SCSI



The recent change to the way scsi_device_get()/put() work broke the
non modular build (we do a module_refcount on a NULL).  Fix this by
checking for non-null before checking module_refcount().

Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 884d25cc
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -873,10 +873,12 @@ EXPORT_SYMBOL(scsi_device_get);
 */
 */
void scsi_device_put(struct scsi_device *sdev)
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()
	/* The module refcount will be zero if scsi_device_get()
	 * was called from a module removal routine */
	 * was called from a module removal routine */
	if (likely(module_refcount(sdev->host->hostt->module) != 0))
	if (module && module_refcount(module) != 0)
		module_put(sdev->host->hostt->module);
		module_put(module);
	put_device(&sdev->sdev_gendev);
	put_device(&sdev->sdev_gendev);
}
}
EXPORT_SYMBOL(scsi_device_put);
EXPORT_SYMBOL(scsi_device_put);