aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bluetooth/btmrvl_sdio.c15
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);
1024unreg_dev: 1021unreg_dev:
1025 btmrvl_sdio_unregister_dev(card); 1022 btmrvl_sdio_unregister_dev(card);
1026free_card:
1027 kfree(card);
1028done:
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}