aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/sbp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/sbp2.c')
-rw-r--r--drivers/ieee1394/sbp2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index eca92eb475a1..0b2b0da5b883 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -755,6 +755,12 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
755#endif 755#endif
756 } 756 }
757 757
758 /* Prevent unloading of the 1394 host */
759 if (!try_module_get(hi->host->driver->owner)) {
760 SBP2_ERR("failed to get a reference on 1394 host driver");
761 goto failed_alloc;
762 }
763
758 scsi_id->hi = hi; 764 scsi_id->hi = hi;
759 765
760 list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); 766 list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids);
@@ -1015,6 +1021,9 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
1015 1021
1016 scsi_id->ud->device.driver_data = NULL; 1022 scsi_id->ud->device.driver_data = NULL;
1017 1023
1024 if (hi)
1025 module_put(hi->host->driver->owner);
1026
1018 SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); 1027 SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id);
1019 1028
1020 kfree(scsi_id); 1029 kfree(scsi_id);