Bluetooth: Use devm_kzalloc in bcm203x.c file.
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Sep 29 10:59:23 EDT 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=9357cc60789cfdcbbeeff85d9c423a91d621ae1f
Commit: 9357cc60789cfdcbbeeff85d9c423a91d621ae1f
Parent: de9b9212c7fd3e87608194f1c73fc06cd6cc7dfb
Author: Sachin Kamat <sachin.kamat at linaro.org>
AuthorDate: Fri Jul 27 12:38:31 2012 +0530
Committer: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
CommitDate: Mon Aug 6 15:03:00 2012 -0300
Bluetooth: Use devm_kzalloc in bcm203x.c file.
devm_kzalloc() eliminates the need to free memory explicitly
thereby saving some cleanup code.
Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
Acked-by: Marcel Holtmann <marcel at holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
---
drivers/bluetooth/bcm203x.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
index 37ae175..364f82b 100644
--- a/drivers/bluetooth/bcm203x.c
+++ b/drivers/bluetooth/bcm203x.c
@@ -177,7 +177,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
BT_ERR("Can't allocate memory for data structure");
return -ENOMEM;
@@ -189,14 +189,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
data->urb = usb_alloc_urb(0, GFP_KERNEL);
if (!data->urb) {
BT_ERR("Can't allocate URB");
- kfree(data);
return -ENOMEM;
}
if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) {
BT_ERR("Mini driver request failed");
usb_free_urb(data->urb);
- kfree(data);
return -EIO;
}
@@ -209,7 +207,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
BT_ERR("Can't allocate memory for mini driver");
release_firmware(firmware);
usb_free_urb(data->urb);
- kfree(data);
return -ENOMEM;
}
@@ -224,7 +221,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
BT_ERR("Firmware request failed");
usb_free_urb(data->urb);
kfree(data->buffer);
- kfree(data);
return -EIO;
}
@@ -236,7 +232,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
release_firmware(firmware);
usb_free_urb(data->urb);
kfree(data->buffer);
- kfree(data);
return -ENOMEM;
}
@@ -271,7 +266,6 @@ static void bcm203x_disconnect(struct usb_interface *intf)
usb_free_urb(data->urb);
kfree(data->fw_data);
kfree(data->buffer);
- kfree(data);
}
static struct usb_driver bcm203x_driver = {
More information about the linux-mtd-cvs
mailing list