Do not Oops, even if mmc_cd_gpio_free() is mistakenly called on a
driver-cleanup path, even though a previous call to mmc_cd_gpio_request()
failed.

Signed-off-by: Guennadi Liakhovetski <g.liakhovet...@gmx.de>
---

Hi Chris

Unfortunately, as I submitted the final version of the original cd-gpio 
patch http://article.gmane.org/gmane.linux.kernel.mmc/12013 I forgot, that 
I'd already sent a v2 and hadn't incremented the version to v3. And that 
version contained the below fix, that went lost because of the wrong 
version number. So, please, push this incremental fix for 3.4, because 
otherwise some error-paths of the tmio-mmc driver can Oops.

 drivers/mmc/core/cd-gpio.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 29de31e..56b854d 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -72,6 +72,9 @@ void mmc_cd_gpio_free(struct mmc_host *host)
 {
        struct mmc_cd_gpio *cd = host->hotplug.handler_priv;
 
+       if (!cd)
+               return;
+
        free_irq(host->hotplug.irq, host);
        gpio_free(cd->gpio);
        kfree(cd);
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to