diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-07-03 03:38:31 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-07-09 15:10:43 +0200 |
commit | 36b312792b97933dc07abe074f50941199bd357c (patch) | |
tree | 8824e31d156cf796ad2666a277af77617fa0e8bb /drivers/gpio | |
parent | f8b52dd50ccdae7efc42ef54278f29d2f9d6cb36 (diff) | |
download | linux-stable-36b312792b97933dc07abe074f50941199bd357c.tar.gz linux-stable-36b312792b97933dc07abe074f50941199bd357c.tar.bz2 linux-stable-36b312792b97933dc07abe074f50941199bd357c.zip |
gpiolib: Respect error code of ->get_direction()
In case we try to lock GPIO pin as IRQ when something going wrong
we print a misleading message.
Correct this by checking an error code from ->get_direction() in
gpiochip_lock_as_irq() and printing a corresponding message.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f15a222205c6..8ec51b7777c6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3262,6 +3262,12 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset) if (!chip->can_sleep && chip->get_direction) { int dir = chip->get_direction(chip, offset); + if (dir < 0) { + chip_err(chip, "%s: cannot get GPIO direction\n", + __func__); + return dir; + } + if (dir) clear_bit(FLAG_IS_OUT, &desc->flags); else |