diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-07-27 03:08:31 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-08-06 14:03:00 -0400 |
commit | 9357cc60789cfdcbbeeff85d9c423a91d621ae1f (patch) | |
tree | ff8a112855c9acaa0c38526fb145d80258496687 /drivers/bluetooth | |
parent | de9b9212c7fd3e87608194f1c73fc06cd6cc7dfb (diff) |
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@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/bcm203x.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index 37ae175162f3..364f82b34d03 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 | |||
177 | if (intf->cur_altsetting->desc.bInterfaceNumber != 0) | 177 | if (intf->cur_altsetting->desc.bInterfaceNumber != 0) |
178 | return -ENODEV; | 178 | return -ENODEV; |
179 | 179 | ||
180 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 180 | data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); |
181 | if (!data) { | 181 | if (!data) { |
182 | BT_ERR("Can't allocate memory for data structure"); | 182 | BT_ERR("Can't allocate memory for data structure"); |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
@@ -189,14 +189,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
189 | data->urb = usb_alloc_urb(0, GFP_KERNEL); | 189 | data->urb = usb_alloc_urb(0, GFP_KERNEL); |
190 | if (!data->urb) { | 190 | if (!data->urb) { |
191 | BT_ERR("Can't allocate URB"); | 191 | BT_ERR("Can't allocate URB"); |
192 | kfree(data); | ||
193 | return -ENOMEM; | 192 | return -ENOMEM; |
194 | } | 193 | } |
195 | 194 | ||
196 | if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) { | 195 | if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) { |
197 | BT_ERR("Mini driver request failed"); | 196 | BT_ERR("Mini driver request failed"); |
198 | usb_free_urb(data->urb); | 197 | usb_free_urb(data->urb); |
199 | kfree(data); | ||
200 | return -EIO; | 198 | return -EIO; |
201 | } | 199 | } |
202 | 200 | ||
@@ -209,7 +207,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
209 | BT_ERR("Can't allocate memory for mini driver"); | 207 | BT_ERR("Can't allocate memory for mini driver"); |
210 | release_firmware(firmware); | 208 | release_firmware(firmware); |
211 | usb_free_urb(data->urb); | 209 | usb_free_urb(data->urb); |
212 | kfree(data); | ||
213 | return -ENOMEM; | 210 | return -ENOMEM; |
214 | } | 211 | } |
215 | 212 | ||
@@ -224,7 +221,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
224 | BT_ERR("Firmware request failed"); | 221 | BT_ERR("Firmware request failed"); |
225 | usb_free_urb(data->urb); | 222 | usb_free_urb(data->urb); |
226 | kfree(data->buffer); | 223 | kfree(data->buffer); |
227 | kfree(data); | ||
228 | return -EIO; | 224 | return -EIO; |
229 | } | 225 | } |
230 | 226 | ||
@@ -236,7 +232,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
236 | release_firmware(firmware); | 232 | release_firmware(firmware); |
237 | usb_free_urb(data->urb); | 233 | usb_free_urb(data->urb); |
238 | kfree(data->buffer); | 234 | kfree(data->buffer); |
239 | kfree(data); | ||
240 | return -ENOMEM; | 235 | return -ENOMEM; |
241 | } | 236 | } |
242 | 237 | ||
@@ -271,7 +266,6 @@ static void bcm203x_disconnect(struct usb_interface *intf) | |||
271 | usb_free_urb(data->urb); | 266 | usb_free_urb(data->urb); |
272 | kfree(data->fw_data); | 267 | kfree(data->fw_data); |
273 | kfree(data->buffer); | 268 | kfree(data->buffer); |
274 | kfree(data); | ||
275 | } | 269 | } |
276 | 270 | ||
277 | static struct usb_driver bcm203x_driver = { | 271 | static struct usb_driver bcm203x_driver = { |