From: Will McVicker <willmcvicker@google.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Thierry Reding <treding@nvidia.com>
Cc: Edmond Chung <edmondchung@google.com>,
Andrew Chant <achant@google.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@android.com, Will McVicker <willmcvicker@google.com>
Subject: [PATCH v1 1/1] gpiolib: Don't free if pin ranges are not defined
Date: Mon, 30 Nov 2020 22:47:53 +0000 [thread overview]
Message-ID: <20201130224753.1569357-2-willmcvicker@google.com> (raw)
In-Reply-To: <20201130224753.1569357-1-willmcvicker@google.com>
From: Edmond Chung <edmondchung@google.com>
A similar check was added in gpiochip_generic_request, but not in free.
This has caused an imbalance count of request vs. free calls to the
pinctrl driver. This patch is targeted to fix that issue.
Fixes: 2ab73c6d8323 ("gpio: Support GPIO controllers without pin-ranges")
Signed-off-by: Edmond Chung <edmondchung@google.com>
Signed-off-by: Andrew Chant <achant@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
---
drivers/gpio/gpiolib.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 089ddcaa9bc6..6e3c4d7a7d14 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request);
*/
void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset)
{
+#ifdef CONFIG_PINCTRL
+ if (list_empty(&gc->gpiodev->pin_ranges))
+ return;
+#endif
+
pinctrl_gpio_free(gc->gpiodev->base + offset);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_free);
--
2.29.2.454.gaff20da3a2-goog
next prev parent reply other threads:[~2020-11-30 22:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 22:47 [PATCH v1 0/1] " Will McVicker
2020-11-30 22:47 ` Will McVicker [this message]
2020-12-01 14:41 ` [PATCH v1 1/1] " Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201130224753.1569357-2-willmcvicker@google.com \
--to=willmcvicker@google.com \
--cc=achant@google.com \
--cc=bgolaszewski@baylibre.com \
--cc=edmondchung@google.com \
--cc=kernel-team@android.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome