[PATCH] mmc: cd-gpio: allow NULL context in mmc_cd_gpio_free()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.liakhovetski@xxxxxx>
---

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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux