mmc: sdhci: add error checking for mmc_add_host
PATCH v2 1/1 mmc: sdhci: add error checking for mmc_add_host
Sometimes we can't add the device,but we didn't check any error status. Need to check error status for mmc_add_host.
--- drivers/mmc/host/sdhci.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +12 -2
@@ -2025,7 +2025,9 @@ int sdhci_add_host(struct sdhci_host *host)mmiowb (); -mmc_add_host (mmc); + ret =mmc_add_host (mmc); +if (unlikely (ret)) + goto err_free_mmc; printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s\n", mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)),
@@ -2036,11 +2038,19 @@ int sdhci_add_host(struct sdhci_host *host)return 0 ; +err_free_mmc: +mmc_free_host (host); +#ifdef SDHCI_USE_LEDS_CLASS reset: +#endif sdhci_reset (host,SDHCI_RESET_ALL );free_irq (host->irq, host); -#endif +if (host->vmmc) { +regulator_disable (host->vmmc); +regulator_put (host->vmmc); + } + untasklet:tasklet_kill (&host->card_tasklet);tasklet_kill (&host->finish_tasklet);
Quoted 6 lines · Jaehoon Chung
Sometimes we can't add the device,but we didn't check any error status. Need to check error status for
mmc_add_host.Signed-off-by Jaehoon Chung <[email protected]>Signed-off-by kyungmin Park <[email protected]>---
Please add here what changed since the last revision.
You are still leaking the led_classdev. Why do you free the mmc_host when registering it failed? Looking at the remove function as comparison, there are still some buffers, timers, etc, forgotten :( Could you fix that, too, please?
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 2 lines
registering it failed? Looking at the remove function as comparison, there are still some buffers, timers, etc, forgotten :( Could you fix that, too, please?
To avoid misunderstandings, that sad smiley didn't mean you but the state of the current error-path in general.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |