linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: don't put the reference to GPIO device in pinctrl_pins_show()
@ 2024-02-23 12:30 Bartosz Golaszewski
  2024-02-23 12:34 ` Bartosz Golaszewski
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2024-02-23 12:30 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, David Arcari

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

The call to gpiod_to_gpio_device() does not increase the reference count
of the GPIO device struct so it must not be decreased. Remove the buggy
__free() decorator.

Reported-by: David Arcari <darcari@redhat.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/pinctrl/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index ee56856cb80c..bbcdece83bf4 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1644,7 +1644,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
 	const struct pinctrl_ops *ops = pctldev->desc->pctlops;
 	unsigned int i, pin;
 #ifdef CONFIG_GPIOLIB
-	struct gpio_device *gdev __free(gpio_device_put) = NULL;
+	struct gpio_device *gdev = NULL;
 	struct pinctrl_gpio_range *range;
 	int gpio_num;
 #endif
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl: don't put the reference to GPIO device in pinctrl_pins_show()
@ 2024-02-23 12:32 Bartosz Golaszewski
  2024-02-29 13:37 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2024-02-23 12:32 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, David Arcari

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

The call to gpiod_to_gpio_device() does not increase the reference count
of the GPIO device struct so it must not be decreased. Remove the buggy
__free() decorator.

Fixes: 524fc108b895 ("pinctrl: stop using gpiod_to_chip()")
Reported-by: David Arcari <darcari@redhat.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/pinctrl/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index ee56856cb80c..bbcdece83bf4 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1644,7 +1644,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
 	const struct pinctrl_ops *ops = pctldev->desc->pctlops;
 	unsigned int i, pin;
 #ifdef CONFIG_GPIOLIB
-	struct gpio_device *gdev __free(gpio_device_put) = NULL;
+	struct gpio_device *gdev = NULL;
 	struct pinctrl_gpio_range *range;
 	int gpio_num;
 #endif
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: don't put the reference to GPIO device in pinctrl_pins_show()
  2024-02-23 12:30 Bartosz Golaszewski
@ 2024-02-23 12:34 ` Bartosz Golaszewski
  0 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2024-02-23 12:34 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, David Arcari

On Fri, Feb 23, 2024 at 1:30 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> The call to gpiod_to_gpio_device() does not increase the reference count
> of the GPIO device struct so it must not be decreased. Remove the buggy
> __free() decorator.
>
> Reported-by: David Arcari <darcari@redhat.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/pinctrl/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index ee56856cb80c..bbcdece83bf4 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -1644,7 +1644,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
>         const struct pinctrl_ops *ops = pctldev->desc->pctlops;
>         unsigned int i, pin;
>  #ifdef CONFIG_GPIOLIB
> -       struct gpio_device *gdev __free(gpio_device_put) = NULL;
> +       struct gpio_device *gdev = NULL;
>         struct pinctrl_gpio_range *range;
>         int gpio_num;
>  #endif
> --
> 2.40.1
>

Linus,

Disregard this one, it had no Fixes tag but I didn't press Ctrl-c in time.

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: don't put the reference to GPIO device in pinctrl_pins_show()
  2024-02-23 12:32 [PATCH] pinctrl: don't put the reference to GPIO device in pinctrl_pins_show() Bartosz Golaszewski
@ 2024-02-29 13:37 ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2024-02-29 13:37 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, David Arcari

On Fri, Feb 23, 2024 at 1:32 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> The call to gpiod_to_gpio_device() does not increase the reference count
> of the GPIO device struct so it must not be decreased. Remove the buggy
> __free() decorator.
>
> Fixes: 524fc108b895 ("pinctrl: stop using gpiod_to_chip()")
> Reported-by: David Arcari <darcari@redhat.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Patch applied for fixes!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-29 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 12:32 [PATCH] pinctrl: don't put the reference to GPIO device in pinctrl_pins_show() Bartosz Golaszewski
2024-02-29 13:37 ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2024-02-23 12:30 Bartosz Golaszewski
2024-02-23 12:34 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).