|
@@ -160,7 +160,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
|
|
|
pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n",
|
|
|
func->vendor, func->device, func->class, func->num);
|
|
|
|
|
|
- card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL);
|
|
|
+ card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL);
|
|
|
if (!card)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -193,7 +193,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
|
|
|
|
|
|
if (ret) {
|
|
|
dev_err(&func->dev, "failed to enable function\n");
|
|
|
- goto err_free;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/* device tree node parsing and platform specific configuration*/
|
|
@@ -218,8 +218,6 @@ err_disable:
|
|
|
sdio_claim_host(func);
|
|
|
sdio_disable_func(func);
|
|
|
sdio_release_host(func);
|
|
|
-err_free:
|
|
|
- kfree(card);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
@@ -2248,8 +2246,6 @@ static void mwifiex_cleanup_sdio(struct mwifiex_adapter *adapter)
|
|
|
kfree(card->mpa_rx.len_arr);
|
|
|
kfree(card->mpa_tx.buf);
|
|
|
kfree(card->mpa_rx.buf);
|
|
|
- sdio_set_drvdata(card->func, NULL);
|
|
|
- kfree(card);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -2299,6 +2295,14 @@ static void mwifiex_recreate_adapter(struct sdio_mmc_card *card)
|
|
|
|
|
|
mwifiex_sdio_remove(func);
|
|
|
|
|
|
+ /*
|
|
|
+ * Normally, we would let the driver core take care of releasing these.
|
|
|
+ * But we're not letting the driver core handle this one. See above
|
|
|
+ * TODO.
|
|
|
+ */
|
|
|
+ sdio_set_drvdata(func, NULL);
|
|
|
+ devm_kfree(&func->dev, card);
|
|
|
+
|
|
|
/* power cycle the adapter */
|
|
|
sdio_claim_host(func);
|
|
|
mmc_hw_reset(func->card->host);
|