3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guennadi Liakhovetski <redacted>
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 <redacted>
[stable@: please apply to 3.3-stable]
Signed-off-by: Chris Ball <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/core/cd-gpio.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -73,6 +73,9 @@ void mmc_cd_gpio_free(struct mmc_host *h
{
struct mmc_cd_gpio *cd = host->hotplug.handler_priv;
+ if (!cd)
+ return;
+
free_irq(host->hotplug.irq, host);
gpio_free(cd->gpio);
kfree(cd);