diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-07-27 03:08:40 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-08-06 14:03:02 -0400 |
commit | 4f8d81584964730b08753da34f1e3fb7981cf742 (patch) | |
tree | a4ccb7ce8b4b20ee35c4eb886c2a0655c4dc5e12 /drivers/bluetooth | |
parent | 98921dbd00c4e2e4bdd56423cb5edf98d57b45f7 (diff) |
Bluetooth: Use devm_kzalloc in btwilink.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/btwilink.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c index 88694697f34f..4ad7b35cfc0e 100644 --- a/drivers/bluetooth/btwilink.c +++ b/drivers/bluetooth/btwilink.c | |||
@@ -297,16 +297,14 @@ static int bt_ti_probe(struct platform_device *pdev) | |||
297 | struct hci_dev *hdev; | 297 | struct hci_dev *hdev; |
298 | int err; | 298 | int err; |
299 | 299 | ||
300 | hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL); | 300 | hst = devm_kzalloc(&pdev->dev, sizeof(struct ti_st), GFP_KERNEL); |
301 | if (!hst) | 301 | if (!hst) |
302 | return -ENOMEM; | 302 | return -ENOMEM; |
303 | 303 | ||
304 | /* Expose "hciX" device to user space */ | 304 | /* Expose "hciX" device to user space */ |
305 | hdev = hci_alloc_dev(); | 305 | hdev = hci_alloc_dev(); |
306 | if (!hdev) { | 306 | if (!hdev) |
307 | kfree(hst); | ||
308 | return -ENOMEM; | 307 | return -ENOMEM; |
309 | } | ||
310 | 308 | ||
311 | BT_DBG("hdev %p", hdev); | 309 | BT_DBG("hdev %p", hdev); |
312 | 310 | ||
@@ -321,7 +319,6 @@ static int bt_ti_probe(struct platform_device *pdev) | |||
321 | err = hci_register_dev(hdev); | 319 | err = hci_register_dev(hdev); |
322 | if (err < 0) { | 320 | if (err < 0) { |
323 | BT_ERR("Can't register HCI device error %d", err); | 321 | BT_ERR("Can't register HCI device error %d", err); |
324 | kfree(hst); | ||
325 | hci_free_dev(hdev); | 322 | hci_free_dev(hdev); |
326 | return err; | 323 | return err; |
327 | } | 324 | } |
@@ -347,7 +344,6 @@ static int bt_ti_remove(struct platform_device *pdev) | |||
347 | hci_unregister_dev(hdev); | 344 | hci_unregister_dev(hdev); |
348 | 345 | ||
349 | hci_free_dev(hdev); | 346 | hci_free_dev(hdev); |
350 | kfree(hst); | ||
351 | 347 | ||
352 | dev_set_drvdata(&pdev->dev, NULL); | 348 | dev_set_drvdata(&pdev->dev, NULL); |
353 | return 0; | 349 | return 0; |