Re: [PATCH] mmc: slot-gpio: Fix missing assignment to ctx->ro_gpio

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

 



Hi Chris

On Sat, 8 Sep 2012, Chris Ball wrote:

> 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.
> 
> Cc: stable <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Chris Ball <cjb@xxxxxxxxxx>
> ---
>  drivers/mmc/core/slot-gpio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index 0582429..4f9b366 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -99,6 +99,7 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio)
>  		return ret;
>  
>  	ctx = host->slot.handler_priv;
> +	ctx->ro_gpio = gpio;

Huh, I wonder how this got lost. But, please, let's do it a bit 
differently. If gpio_request_one() fails, ctx->ro_gpio shouldn't contain a 
valid GPIO number. So, I think, it should be

+	ret = gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label);
+	if (ret < 0)
+		return ret;
+
+	ctx->ro_gpio = gpio;
+
+	return 0;

Agree?

Thanks
Guennadi

>  
>  	return gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label);
>  }
> -- 
> Chris Ball   <cjb@xxxxxxxxxx>   <http://printf.net/>
> One Laptop Per Child
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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