Commit a82f65aa authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Kalle Valo

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: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: default avatarJulian Calaby <julian.calaby@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 032e0f54
......@@ -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,11 +194,17 @@ 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);
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment