diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-07-27 03:08:32 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-08-06 14:03:00 -0400 |
commit | 0213cd8d5ed9cee1d7ffd95566319af1bb36a604 (patch) | |
tree | 6da2a3724414ba194ca787679739f0a0ee078298 /drivers/bluetooth | |
parent | 9357cc60789cfdcbbeeff85d9c423a91d621ae1f (diff) |
Bluetooth: Use devm_kzalloc in bfusb.c file
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/bfusb.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 32e825144fe9..995aee9cba22 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c | |||
@@ -653,7 +653,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
653 | } | 653 | } |
654 | 654 | ||
655 | /* Initialize control structure and load firmware */ | 655 | /* Initialize control structure and load firmware */ |
656 | data = kzalloc(sizeof(struct bfusb_data), GFP_KERNEL); | 656 | data = devm_kzalloc(&intf->dev, sizeof(struct bfusb_data), GFP_KERNEL); |
657 | if (!data) { | 657 | if (!data) { |
658 | BT_ERR("Can't allocate memory for control structure"); | 658 | BT_ERR("Can't allocate memory for control structure"); |
659 | goto done; | 659 | goto done; |
@@ -674,7 +674,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
674 | 674 | ||
675 | if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) { | 675 | if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) { |
676 | BT_ERR("Firmware request failed"); | 676 | BT_ERR("Firmware request failed"); |
677 | goto error; | 677 | goto done; |
678 | } | 678 | } |
679 | 679 | ||
680 | BT_DBG("firmware data %p size %zu", firmware->data, firmware->size); | 680 | BT_DBG("firmware data %p size %zu", firmware->data, firmware->size); |
@@ -690,7 +690,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
690 | hdev = hci_alloc_dev(); | 690 | hdev = hci_alloc_dev(); |
691 | if (!hdev) { | 691 | if (!hdev) { |
692 | BT_ERR("Can't allocate HCI device"); | 692 | BT_ERR("Can't allocate HCI device"); |
693 | goto error; | 693 | goto done; |
694 | } | 694 | } |
695 | 695 | ||
696 | data->hdev = hdev; | 696 | data->hdev = hdev; |
@@ -708,7 +708,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
708 | if (hci_register_dev(hdev) < 0) { | 708 | if (hci_register_dev(hdev) < 0) { |
709 | BT_ERR("Can't register HCI device"); | 709 | BT_ERR("Can't register HCI device"); |
710 | hci_free_dev(hdev); | 710 | hci_free_dev(hdev); |
711 | goto error; | 711 | goto done; |
712 | } | 712 | } |
713 | 713 | ||
714 | usb_set_intfdata(intf, data); | 714 | usb_set_intfdata(intf, data); |
@@ -718,9 +718,6 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
718 | release: | 718 | release: |
719 | release_firmware(firmware); | 719 | release_firmware(firmware); |
720 | 720 | ||
721 | error: | ||
722 | kfree(data); | ||
723 | |||
724 | done: | 721 | done: |
725 | return -EIO; | 722 | return -EIO; |
726 | } | 723 | } |
@@ -741,7 +738,6 @@ static void bfusb_disconnect(struct usb_interface *intf) | |||
741 | 738 | ||
742 | hci_unregister_dev(hdev); | 739 | hci_unregister_dev(hdev); |
743 | hci_free_dev(hdev); | 740 | hci_free_dev(hdev); |
744 | kfree(data); | ||
745 | } | 741 | } |
746 | 742 | ||
747 | static struct usb_driver bfusb_driver = { | 743 | static struct usb_driver bfusb_driver = { |