Bluetooth: Use devm_kzalloc in btmrvl_sdio.c file
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Sep 29 10:59:24 EDT 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=eb17ea3b1ce6302e7416c4ba58754fd70ee3ab62
Commit: eb17ea3b1ce6302e7416c4ba58754fd70ee3ab62
Parent: 4f61cb184fd5d16d591303aacf8dd1e623d2137d
Author: Sachin Kamat <sachin.kamat at linaro.org>
AuthorDate: Fri Jul 27 12:38:36 2012 +0530
Committer: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
CommitDate: Mon Aug 6 15:03:01 2012 -0300
Bluetooth: Use devm_kzalloc in btmrvl_sdio.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/btmrvl_sdio.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 6a9e971..03b3acb 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -956,11 +956,9 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
id->vendor, id->device, id->class, func->num);
- card = kzalloc(sizeof(*card), GFP_KERNEL);
- if (!card) {
- ret = -ENOMEM;
- goto done;
- }
+ card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL);
+ if (!card)
+ return -ENOMEM;
card->func = func;
@@ -974,8 +972,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
if (btmrvl_sdio_register_dev(card) < 0) {
BT_ERR("Failed to register BT device!");
- ret = -ENODEV;
- goto free_card;
+ return -ENODEV;
}
/* Disable the interrupts on the card */
@@ -1023,9 +1020,6 @@ disable_host_int:
btmrvl_sdio_disable_host_int(card);
unreg_dev:
btmrvl_sdio_unregister_dev(card);
-free_card:
- kfree(card);
-done:
return ret;
}
@@ -1047,7 +1041,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func)
BT_DBG("unregester dev");
btmrvl_sdio_unregister_dev(card);
btmrvl_remove_card(card->priv);
- kfree(card);
}
}
}
More information about the linux-mtd-cvs
mailing list