aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2006-09-06 10:00:29 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-09-07 11:37:22 -0400
commitf479ab87936563a286b8aa0e39003c40fa31c6da (patch)
tree9592ef7ca7b68dd2ec5c21e371a6b4ad76be8ac5 /drivers/scsi/scsi.c
parent884d25cc4fda20908fd4ef93dbb41d817984b68b (diff)
[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: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index eedfd059b82b..c35f5fc0d668 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -873,10 +873,12 @@ EXPORT_SYMBOL(scsi_device_get);
873 */ 873 */
874void scsi_device_put(struct scsi_device *sdev) 874void scsi_device_put(struct scsi_device *sdev)
875{ 875{
876 struct module *module = sdev->host->hostt->module;
877
876 /* The module refcount will be zero if scsi_device_get() 878 /* The module refcount will be zero if scsi_device_get()
877 * was called from a module removal routine */ 879 * was called from a module removal routine */
878 if (likely(module_refcount(sdev->host->hostt->module) != 0)) 880 if (module && module_refcount(module) != 0)
879 module_put(sdev->host->hostt->module); 881 module_put(module);
880 put_device(&sdev->sdev_gendev); 882 put_device(&sdev->sdev_gendev);
881} 883}
882EXPORT_SYMBOL(scsi_device_put); 884EXPORT_SYMBOL(scsi_device_put);