gpio: acpi: Do sanity check for GpioInt in acpi_find_gpio()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 23 May 2017 17:03:18 +0000 (20:03 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 29 May 2017 09:17:04 +0000 (11:17 +0200)
Check that we don't ask for output direction on GpioInt resource
in cases with or without _DSD defined.

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-acpi.c

index 055a8a255a402c2d8e431c72401a6537498c2d4a..28f35a9de86b231f63d51d1af9bc0ea27f6cc980 100644 (file)
@@ -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)