diff options
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0b271ef8..56b7c5d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -77,7 +77,9 @@ struct gpio_desc *gpio_to_desc(unsigned gpio) spin_unlock_irqrestore(&gpio_lock, flags); - WARN(1, "invalid GPIO %d\n", gpio); + if (!gpio_is_valid(gpio)) + WARN(1, "invalid GPIO %d\n", gpio); + return NULL; } EXPORT_SYMBOL_GPL(gpio_to_desc); |