From 27c888f0bb889693c6a3b6d39eba3265c16c072f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 13 Sep 2014 19:41:16 -0700 Subject: scsi_dh: get module reference outside of device handler We need to grab a reference to the module before calling the attach routines to avoid a small race vs module removal. It also cleans up the code significantly as a side effect. Signed-off-by: Christoph Hellwig Reviewed-by: Mike Christie Reviewed-by: Hannes Reinecke --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/scsi/device_handler/scsi_dh_hp_sw.c') diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 4824bfbe3051..cf36557a1d4d 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -377,9 +377,6 @@ static int hp_sw_bus_attach(struct scsi_device *sdev) if (ret != SCSI_DH_OK || h->path_state == HP_SW_PATH_UNINITIALIZED) goto failed; - if (!try_module_get(THIS_MODULE)) - goto failed; - spin_lock_irqsave(sdev->request_queue->queue_lock, flags); sdev->scsi_dh_data = scsi_dh_data; spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); @@ -406,7 +403,6 @@ static void hp_sw_bus_detach( struct scsi_device *sdev ) scsi_dh_data = sdev->scsi_dh_data; sdev->scsi_dh_data = NULL; spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); - module_put(THIS_MODULE); sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", HP_SW_NAME); -- cgit v1.2.3