[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200302082448.11795-1-geert+renesas@glider.be>
Date: Mon, 2 Mar 2020 09:24:48 +0100
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH] gpiolib: Fix inverted check in gpiochip_remove()
The optimization to check for requested lines actually optimized for the
uncomon error case, where one of the GPIO lines is still in use.
Hence the error message must be printed when the loop is terminated
early, not when it went through all available GPIO lines.
Fixes: 869233f81337bfb3 ("gpiolib: Optimize gpiochip_remove() when check for requested line")
Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
Noticed by review, tested by creating and destroying an otherwise unused
GPIO aggregator, which triggers:
gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4e78bdc2739693c3..6180cf84fab7ce5e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1823,7 +1823,7 @@ void gpiochip_remove(struct gpio_chip *chip)
}
spin_unlock_irqrestore(&gpio_lock, flags);
- if (i == gdev->ngpio)
+ if (i != gdev->ngpio)
dev_crit(&gdev->dev,
"REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n");
--
2.17.1
Powered by blists - more mailing lists