From: Andy Shevchenko Date: Tue, 23 May 2017 17:03:18 +0000 (+0300) Subject: gpio: acpi: Do sanity check for GpioInt in acpi_find_gpio() X-Git-Tag: v4.13-rc1~116^2~50 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=fe06b56cbf9fd6392f31ba1c782a3134daef7c80;p=linux.git gpio: acpi: Do sanity check for GpioInt in acpi_find_gpio() Check that we don't ask for output direction on GpioInt resource in cases with or without _DSD defined. Reviewed-by: Dmitry Torokhov Signed-off-by: Andy Shevchenko Tested-by: Jarkko Nikula Reviewed-by: Mika Westerberg Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 055a8a255a40..28f35a9de86b 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -622,12 +622,12 @@ struct gpio_desc *acpi_find_gpio(struct device *dev, desc = acpi_get_gpiod_by_index(adev, NULL, idx, &info); if (IS_ERR(desc)) return desc; + } - if ((flags == GPIOD_OUT_LOW || flags == GPIOD_OUT_HIGH) && - info.gpioint) { - dev_dbg(dev, "refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n"); - return ERR_PTR(-ENOENT); - } + if (info.gpioint && + (flags == GPIOD_OUT_LOW || flags == GPIOD_OUT_HIGH)) { + dev_dbg(dev, "refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n"); + return ERR_PTR(-ENOENT); } if (info.polarity == GPIO_ACTIVE_LOW)