mmc: mmc_spi: fix error handling in mmc_spi_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 31 Jan 2023 01:38:35 +0000 (09:38 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 13 Feb 2023 23:09:17 +0000 (00:09 +0100)
commitcf4c9d2ac1e42c7d18b921bec39486896645b714
tree8c361b2f433b39604f46ad5c145e9b2730e67e8f
parent605d9fb9556f8f5fb4566f4df1480f280f308ded
mmc: mmc_spi: fix error handling in mmc_spi_probe()

If mmc_add_host() fails, it doesn't need to call mmc_remove_host(),
or it will cause null-ptr-deref, because of deleting a not added
device in mmc_remove_host().

To fix this, goto label 'fail_glue_init', if mmc_add_host() fails,
and change the label 'fail_add_host' to 'fail_gpiod_request'.

Fixes: 15a0580ced08 ("mmc_spi host driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Cc:stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230131013835.3564011-1-yangyingliang@huawei.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/mmc_spi.c