[PATCH 1/7] atmel_nand: check gpio validity before using it

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Dec 9 08:34:36 EST 2013


On 10:36 Sat 07 Dec     , Eric B??nard wrote:
> else we get : "invalid GPIO -22"
> (as enable_pin is EINVAL)
> 
> tested on SAMA5D35

Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>

> 
> Signed-off-by: Eric Bénard <eric at eukrea.com>
> ---
>  drivers/mtd/nand/atmel_nand.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index a0f0966..658ae52 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -107,7 +107,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
>   */
>  static void atmel_nand_enable(struct atmel_nand_host *host)
>  {
> -	if (host->board->enable_pin)
> +	if (gpio_is_valid(host->board->enable_pin))
>  		gpio_set_value(host->board->enable_pin, 0);
>  }
>  
> @@ -116,7 +116,7 @@ static void atmel_nand_enable(struct atmel_nand_host *host)
>   */
>  static void atmel_nand_disable(struct atmel_nand_host *host)
>  {
> -	if (host->board->enable_pin)
> +	if (gpio_is_valid(host->board->enable_pin))
>  		gpio_set_value(host->board->enable_pin, 1);
>  }
>  
> -- 
> 1.8.3.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox



More information about the barebox mailing list