]> git.hungrycats.org Git - linux/commitdiff
mmc: slot-gpio: Fix missing assignment to ctx->ro_gpio
authorChris Ball <cjb@laptop.org>
Mon, 10 Sep 2012 02:56:48 +0000 (22:56 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Oct 2012 20:50:34 +0000 (05:50 +0900)
commit 15e8a8e42966162c207bb97ed55c803bc437eeae upstream.

mmc_gpio_request_ro() doesn't store the requested gpio in ctx->ro_gpio.
As a result, subsequent calls to mmc_gpio_get_ro() will always fail
with -ENOSYS because the gpio number isn't available to that function.

Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/core/slot-gpio.c

index 058242916cef1089ee2a8a22e8901464df7f4997..08c6b3dfe080497509e9f431d0ababdc51626b29 100644 (file)
@@ -100,7 +100,13 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio)
 
        ctx = host->slot.handler_priv;
 
-       return gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label);
+       ret = gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label);
+       if (ret < 0)
+               return ret;
+
+       ctx->ro_gpio = gpio;
+
+       return 0;
 }
 EXPORT_SYMBOL(mmc_gpio_request_ro);