Skip to contentSkip to conversation

pinctrl: don't put the reference to GPIO device in pinctrl_pins_show()

PATCH In review Bartosz Golaszewski 1 participant 2 messages Feb 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: don't put the reference to GPIO device in pinctrl_pins_show()

From: Bartosz Golaszewski <[email protected]>

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.

---
 drivers/pinctrl/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/core.c +1 -1
index ee56856cb80c..bbcdece83bf4 100644
@@ -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
Signature · 1 line
2.40.1
#1 lore raw
Quoted 27 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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.

---
 drivers/pinctrl/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/core.c +1 -2
index ee56856cb80c..bbcdece83bf4 100644
@@ -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
--
Quoted 2 lines

2.40.1

Linus,

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

Bart