mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
wifi: wfx: Fix error handling in wfx_core_init()
[ Upstream commit 3b88a9876779b55478a4dde867e73f7a100ffa23 ]
The wfx_core_init() returns without checking the retval from
sdio_register_driver().
If the sdio_register_driver() failed, the module failed to install,
leaving the wfx_spi_driver not unregistered.
Fixes: a7a91ca5a2 ("staging: wfx: add infrastructure for new driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241022090453.84679-1-yuancan@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5a8c948d3a
commit
27591e2e91
@@ -479,10 +479,23 @@ static int __init wfx_core_init(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SPI))
|
if (IS_ENABLED(CONFIG_SPI)) {
|
||||||
ret = spi_register_driver(&wfx_spi_driver);
|
ret = spi_register_driver(&wfx_spi_driver);
|
||||||
if (IS_ENABLED(CONFIG_MMC) && !ret)
|
if (ret)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if (IS_ENABLED(CONFIG_MMC)) {
|
||||||
ret = sdio_register_driver(&wfx_sdio_driver);
|
ret = sdio_register_driver(&wfx_sdio_driver);
|
||||||
|
if (ret)
|
||||||
|
goto unregister_spi;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
unregister_spi:
|
||||||
|
if (IS_ENABLED(CONFIG_SPI))
|
||||||
|
spi_unregister_driver(&wfx_spi_driver);
|
||||||
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
module_init(wfx_core_init);
|
module_init(wfx_core_init);
|
||||||
|
|||||||
Reference in New Issue
Block a user