From: David Herrmann Date: Sat, 7 Jan 2012 14:47:16 +0000 (+0100) Subject: Bluetooth: btusb: Free driver data on USB shutdown X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8381088e39d03c55552b9dfb09b9b303e96acc78;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Bluetooth: btusb: Free driver data on USB shutdown Instead of using the hci-destruct callback we free our private driver data on USB shutdown. We already called hci_unregister_dev() here so the hci core will never ever call our callbacks again except the destruct callback. However, there is no reason to keep our *private* driver data alive if we get never called again and the hci-core does never touch it the data. So we simply free it right away and set the destruct callback to NULL. Signed-off-by: David Herrmann Acked-by: Marcel Holtmann Signed-off-by: Johan Hedberg --- diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8bca784c0ea0..44b5e736ddc3 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -783,15 +783,6 @@ done: return err; } -static void btusb_destruct(struct hci_dev *hdev) -{ - struct btusb_data *data = hdev->driver_data; - - BT_DBG("%s", hdev->name); - - kfree(data); -} - static void btusb_notify(struct hci_dev *hdev, unsigned int evt) { struct btusb_data *data = hdev->driver_data; @@ -1004,7 +995,6 @@ static int btusb_probe(struct usb_interface *intf, hdev->close = btusb_close; hdev->flush = btusb_flush; hdev->send = btusb_send_frame; - hdev->destruct = btusb_destruct; hdev->notify = btusb_notify; hdev->owner = THIS_MODULE; @@ -1108,6 +1098,7 @@ static void btusb_disconnect(struct usb_interface *intf) __hci_dev_put(hdev); hci_free_dev(hdev); + kfree(data); } #ifdef CONFIG_PM