From: Jon Hunter Subject: Re: [PATCH 4.14 156/173] gpiolib: Respect error code of ->get_direction() Date: Tue, 25 Sep 2018 15:12:13 +0100 Message-ID: References: <20180924113114.334025954@linuxfoundation.org> <20180924113126.730832814@linuxfoundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180924113126.730832814@linuxfoundation.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Andy Shevchenko , Mika Westerberg , Linus Walleij , Sasha Levin , linux-tegra List-Id: linux-tegra@vger.kernel.org Hi Greg, On 24/09/18 12:53, Greg Kroah-Hartman wrote: > 4.14-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Andy Shevchenko > > [ Upstream commit 36b312792b97933dc07abe074f50941199bd357c ] > > 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 > Cc: Mika Westerberg > Signed-off-by: Linus Walleij > Signed-off-by: Sasha Levin > Signed-off-by: Greg Kroah-Hartman > --- > drivers/gpio/gpiolib.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2811,6 +2811,12 @@ int gpiochip_lock_as_irq(struct gpio_chi > 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 This change is causing a boot regression on Tegra20 and Tegra30. After this change was merged in mainline there was a fix for Tegra [0] that was also needed. On Tegra the above change causes the allocation of GPIOs to fail and looks like this then exposes another bug somewhere else that finally leads to a system crash. If this is needed for stable, then we will need the fix for Tegra as well. Cheers Jon [0] https://lkml.org/lkml/2018/7/17/871 -- nvpublic