Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933563AbdCWTri (ORCPT ); Thu, 23 Mar 2017 15:47:38 -0400 Received: from mga02.intel.com ([134.134.136.20]:17864 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933031AbdCWTrf (ORCPT ); Thu, 23 Mar 2017 15:47:35 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,211,1486454400"; d="scan'208";a="1146201983" From: Andy Shevchenko To: Linus Walleij , Alexandre Courbot , linux-gpio@vger.kernel.org, Dmitry Torokhov , Hans de Goede , linux-kernel@vger.kernel.org, Mika Westerberg , Jarkko Nikula , linux-acpi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 3/8] gpio: acpi: Do sanity check for GpioInt in acpi_find_gpio() Date: Thu, 23 Mar 2017 21:46:13 +0200 Message-Id: <20170323194618.26548-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170323194618.26548-1-andriy.shevchenko@linux.intel.com> References: <20170323194618.26548-1-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1070 Lines: 32 Check that we don't ask for output direction on GpioInt resource in cases with or without _DSD defined. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib-acpi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 3bda3166d418..21e4930ca2db 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -614,12 +614,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) -- 2.11.0