summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_sysfs.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-01-07 15:47:21 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 17:01:24 +0200
commit46e06531a5ae13c66f774d3cb1ad78385618a5a2 (patch)
tree6935c5b0b5717ff689a010408d0ae91104c5f01d /net/bluetooth/hci_sysfs.c
parent587ae086f6e44c3f1d313e3efdfc8c2866784bc3 (diff)
Bluetooth: Correctly acquire module ref
We provide a device-object to other subsystems and we provide our own release-function. Therefore, the device-object must own a reference to our module, otherwise the release-function may get deleted before the device-object does. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r--net/bluetooth/hci_sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 74b49e330a1d..ec03ee2b301e 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -372,6 +372,7 @@ static void bt_host_release(struct device *dev)
{
void *data = dev_get_drvdata(dev);
kfree(data);
+ module_put(THIS_MODULE);
}
static struct device_type bt_host = {
@@ -523,6 +524,7 @@ void hci_init_sysfs(struct hci_dev *hdev)
dev->type = &bt_host;
dev->class = bt_class;
+ __module_get(THIS_MODULE);
dev_set_drvdata(dev, hdev);
device_initialize(dev);
}