atmel_nand: check gpio validity before using it
else we get : "invalid GPIO -22" (as enable_pin is EINVAL) tested on SAMA5D35 Signed-off-by: Eric Bénard <eric@eukrea.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
a4dfb8d910
commit
50b02080c9
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue