diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-07-27 03:08:36 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-08-06 14:03:01 -0400 |
commit | eb17ea3b1ce6302e7416c4ba58754fd70ee3ab62 (patch) | |
tree | 1ebc65b844577fea5dcb0ed442666b8741ea9735 /drivers/bluetooth | |
parent | 4f61cb184fd5d16d591303aacf8dd1e623d2137d (diff) |
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@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/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 6a9e9717d3ab..03b3acba6143 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, | |||
956 | BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d", | 956 | BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d", |
957 | id->vendor, id->device, id->class, func->num); | 957 | id->vendor, id->device, id->class, func->num); |
958 | 958 | ||
959 | card = kzalloc(sizeof(*card), GFP_KERNEL); | 959 | card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL); |
960 | if (!card) { | 960 | if (!card) |
961 | ret = -ENOMEM; | 961 | return -ENOMEM; |
962 | goto done; | ||
963 | } | ||
964 | 962 | ||
965 | card->func = func; | 963 | card->func = func; |
966 | 964 | ||
@@ -974,8 +972,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func, | |||
974 | 972 | ||
975 | if (btmrvl_sdio_register_dev(card) < 0) { | 973 | if (btmrvl_sdio_register_dev(card) < 0) { |
976 | BT_ERR("Failed to register BT device!"); | 974 | BT_ERR("Failed to register BT device!"); |
977 | ret = -ENODEV; | 975 | return -ENODEV; |
978 | goto free_card; | ||
979 | } | 976 | } |
980 | 977 | ||
981 | /* Disable the interrupts on the card */ | 978 | /* Disable the interrupts on the card */ |
@@ -1023,9 +1020,6 @@ disable_host_int: | |||
1023 | btmrvl_sdio_disable_host_int(card); | 1020 | btmrvl_sdio_disable_host_int(card); |
1024 | unreg_dev: | 1021 | unreg_dev: |
1025 | btmrvl_sdio_unregister_dev(card); | 1022 | btmrvl_sdio_unregister_dev(card); |
1026 | free_card: | ||
1027 | kfree(card); | ||
1028 | done: | ||
1029 | return ret; | 1023 | return ret; |
1030 | } | 1024 | } |
1031 | 1025 | ||
@@ -1047,7 +1041,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func) | |||
1047 | BT_DBG("unregester dev"); | 1041 | BT_DBG("unregester dev"); |
1048 | btmrvl_sdio_unregister_dev(card); | 1042 | btmrvl_sdio_unregister_dev(card); |
1049 | btmrvl_remove_card(card->priv); | 1043 | btmrvl_remove_card(card->priv); |
1050 | kfree(card); | ||
1051 | } | 1044 | } |
1052 | } | 1045 | } |
1053 | } | 1046 | } |