From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH] gpiolib: don't bail out if get_direction() fails in gpiochip_add_data()
Date: Thu, 20 Feb 2025 10:17:14 +0100 [thread overview]
Message-ID: <22224aa7-3af6-46f3-8d45-ddb8e5829fc5@samsung.com> (raw)
In-Reply-To: <20250219144356.258635-1-brgl@bgdev.pl>
On 19.02.2025 15:43, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Since commit 9d846b1aebbe ("gpiolib: check the return value of
> gpio_chip::get_direction()") we check the return value of the
> get_direction() callback as per its API contract. Some drivers have been
> observed to fail to register now as they may call get_direction() in
> gpiochip_add_data() in contexts where it has always silently failed.
> Until we audit all drivers, replace the bail-out to a kernel log
> warning.
>
> Fixes: 9d846b1aebbe ("gpiolib: check the return value of gpio_chip::get_direction()")
> Reported-by: Mark Brown <broonie@kernel.org>
> Closes: https://lore.kernel.org/all/Z7VFB1nST6lbmBIo@finisterre.sirena.org.uk/
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Closes: https://lore.kernel.org/all/dfe03f88-407e-4ef1-ad30-42db53bbd4e4@samsung.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
This fixes the issue observed on RPi boards without any changes to
gpio/pinctrl driver.
> ---
> drivers/gpio/gpiolib.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 704452fd94bb..48cf1bb23e24 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1060,7 +1060,15 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
> if (gc->get_direction && gpiochip_line_is_valid(gc, desc_index)) {
> ret = gc->get_direction(gc, desc_index);
> if (ret < 0)
> - goto err_cleanup_desc_srcu;
> + /*
> + * FIXME: Bail-out here once all GPIO drivers
> + * are updated to not return errors in
> + * situations that can be considered normal
> + * operation.
> + */
> + dev_warn(&gdev->dev,
> + "%s: get_direction failed: %d\n",
> + __func__, ret);
>
> assign_bit(FLAG_IS_OUT, &desc->flags, !ret);
> } else {
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2025-02-20 9:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250219144407eucas1p239a17ed94ec6c6467a2b00bab8abb7b8@eucas1p2.samsung.com>
2025-02-19 14:43 ` Bartosz Golaszewski
2025-02-20 9:17 ` Marek Szyprowski [this message]
2025-02-20 12:49 ` Mark Brown
2025-02-20 13:09 ` 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=22224aa7-3af6-46f3-8d45-ddb8e5829fc5@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®