File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -586,10 +586,13 @@ EXPORT_SYMBOL(scsi_device_get);
586
586
*/
587
587
void scsi_device_put (struct scsi_device * sdev )
588
588
{
589
- struct module * mod = sdev -> host -> hostt -> module ;
590
-
589
+ /*
590
+ * Decreasing the module reference count before the device reference
591
+ * count is safe since scsi_remove_host() only returns after all
592
+ * devices have been removed.
593
+ */
594
+ module_put (sdev -> host -> hostt -> module );
591
595
put_device (& sdev -> sdev_gendev );
592
- module_put (mod );
593
596
}
594
597
EXPORT_SYMBOL (scsi_device_put );
595
598
Original file line number Diff line number Diff line change @@ -452,9 +452,6 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
452
452
struct scsi_vpd * vpd_pg0 = NULL , * vpd_pg89 = NULL ;
453
453
struct scsi_vpd * vpd_pgb0 = NULL , * vpd_pgb1 = NULL , * vpd_pgb2 = NULL ;
454
454
unsigned long flags ;
455
- struct module * mod ;
456
-
457
- mod = sdev -> host -> hostt -> module ;
458
455
459
456
scsi_dh_release_device (sdev );
460
457
@@ -521,17 +518,11 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
521
518
522
519
if (parent )
523
520
put_device (parent );
524
- module_put (mod );
525
521
}
526
522
527
523
static void scsi_device_dev_release (struct device * dev )
528
524
{
529
525
struct scsi_device * sdp = to_scsi_device (dev );
530
-
531
- /* Set module pointer as NULL in case of module unloading */
532
- if (!try_module_get (sdp -> host -> hostt -> module ))
533
- sdp -> host -> hostt -> module = NULL ;
534
-
535
526
execute_in_process_context (scsi_device_dev_release_usercontext ,
536
527
& sdp -> ew );
537
528
}
You can’t perform that action at this time.
0 commit comments