summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/marvell/mwifiex/sdio.c
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier@osg.samsung.com>2016-05-27 17:18:18 +0300
committerKalle Valo <kvalo@codeaurora.org>2016-06-16 18:05:07 +0300
commita82f65aae143f298e7b795ffd8f1cbbe76653a90 (patch)
tree0f4f0c3f17b85282a7f38ab4c88c3bdc72ed593c /drivers/net/wireless/marvell/mwifiex/sdio.c
parent032e0f546c7e36217ebcae33f82d390c272d00ea (diff)
downloadlinux-a82f65aae143f298e7b795ffd8f1cbbe76653a90.tar.xz
mwifiex: consolidate mwifiex_sdio_probe() error paths
Instead of duplicating part of the cleanups needed in case of an error in .probe callback, have a single error path and use goto labels as is common practice in the kernel. This also has the nice side effect that the cleanup operations are made in the inverse order of their counterparts, which was not the case for the mwifiex_add_card() error path. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell/mwifiex/sdio.c')
-rw-r--r--drivers/net/wireless/marvell/mwifiex/sdio.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index b248d10f09df..a3fd0a1a0941 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -183,8 +183,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
if (ret) {
pr_err("%s: failed to enable function\n", __func__);
- kfree(card);
- return ret;
+ goto err_free;
}
/* device tree node parsing and platform specific configuration*/
@@ -195,12 +194,18 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
MWIFIEX_SDIO);
if (ret) {
pr_err("%s: add card failed\n", __func__);
- kfree(card);
- sdio_claim_host(func);
- sdio_disable_func(func);
- sdio_release_host(func);
+ goto err_disable;
}
+ return 0;
+
+err_disable:
+ sdio_claim_host(func);
+ sdio_disable_func(func);
+ sdio_release_host(func);
+err_free:
+ kfree(card);
+
return ret;
}