aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-04-24 17:56:29 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-01 15:15:53 +0800
commit9011fd18ebcfcb648761afb3e23bf55e55bc038c (patch)
treec3b21c92c0e9a42ad4d3da1a07db16272ffc19ba /drivers/mmc
parent591c8732fb7d28b5a5d1299bf8822f3880efaa47 (diff)
mmc: cd-gpio: protect against NULL context in mmc_cd_gpio_free()
commit 0e9f480bb553d39ee06ccd45639ba7a5446a7b81 upstream. 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@gmx.de> [stable@: please apply to 3.3-stable] Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/cd-gpio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 082202ae4a0..8c3e6f0ff78 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -67,6 +67,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);