[PATCH] pinctrl: bcm2835: Handle gpiochip_add_pin_range() errors

Christophe JAILLET posted 1 patch 2 years, 8 months ago
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
[PATCH] pinctrl: bcm2835: Handle gpiochip_add_pin_range() errors
Posted by Christophe JAILLET 2 years, 8 months ago
gpiochip_add_pin_range() can fail, so better return its error code than
a hard coded '0'.

Fixes: d2b67744fd99 ("pinctrl: bcm2835: implement hook for missing gpio-ranges")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative and compile tested only.

If it is wrong, maybe a comment explaining why 0 should be returned would
be welcomed.
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 8e2551a08c37..cb298fad354a 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -366,10 +366,8 @@ static int bcm2835_add_pin_ranges_fallback(struct gpio_chip *gc)
 	if (!pctldev)
 		return 0;
 
-	gpiochip_add_pin_range(gc, pinctrl_dev_get_devname(pctldev), 0, 0,
-			       gc->ngpio);
-
-	return 0;
+	return gpiochip_add_pin_range(gc, pinctrl_dev_get_devname(pctldev), 0, 0,
+				      gc->ngpio);
 }
 
 static const struct gpio_chip bcm2835_gpio_chip = {
-- 
2.34.1
Re: [PATCH] pinctrl: bcm2835: Handle gpiochip_add_pin_range() errors
Posted by Linus Walleij 2 years, 7 months ago
On Sun, Apr 16, 2023 at 11:43 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:

> gpiochip_add_pin_range() can fail, so better return its error code than
> a hard coded '0'.
>
> Fixes: d2b67744fd99 ("pinctrl: bcm2835: implement hook for missing gpio-ranges")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Patch applied for the next kernel cycle (becoming v6.5)

Yours,
Linus Walleij