Skip to contentSkip to conversation

gpio: winbond: Fix error code in winbond_gpio_get()

PATCH Applied Dan Carpenter 3 participants 3 messages Jun 23, 2022

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

PATCH 1/1 gpio: winbond: Fix error code in winbond_gpio_get()

This error path returns 1, but it should instead propagate the negative error code from winbond_sio_enter().

Fixes a0d65009411c ("gpio: winbond: Add driver")
---
 drivers/gpio/gpio-winbond.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpio/gpio-winbond.c +4 -3
index 7f8f5b02e31d..4b61d975cc0e 100644
@@ -385,12 +385,13 @@ static int winbond_gpio_get(struct gpio_chip *gc, unsigned int offset)
 	unsigned long *base = gpiochip_get_data(gc);
 	const struct winbond_gpio_info *info;
 	bool val;
+	int ret;
 
 	winbond_gpio_get_info(&offset, &info);
 
-	val = winbond_sio_enter(*base);
-	if (val)
-		return val;
+	ret = winbond_sio_enter(*base);
+	if (ret)
+		return ret;
 
 	winbond_sio_select_logical(*base, info->dev);
 
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Dan Carpenter

This error path returns 1, but it should instead propagate the negative error code from winbond_sio_enter().

Quoted 30 lines
Fixes a0d65009411c ("gpio: winbond: Add driver")
---
 drivers/gpio/gpio-winbond.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpio/gpio-winbond.c +4 -3
index 7f8f5b02e31d..4b61d975cc0e 100644
@@ -385,12 +385,13 @@ static int winbond_gpio_get(struct gpio_chip *gc, unsigned int offset)
 	unsigned long *base = gpiochip_get_data(gc);
 	const struct winbond_gpio_info *info;
 	bool val;
+	int ret;
 
 	winbond_gpio_get_info(&offset, &info);
 
-	val = winbond_sio_enter(*base);
-	if (val)
-		return val;
+	ret = winbond_sio_enter(*base);
+	if (ret)
+		return ret;
 
 	winbond_sio_select_logical(*base, info->dev);
 
Signature · 1 line
2.35.1
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Dan Carpenter
Quoted 32 lines · Dan Carpenter

This error path returns 1, but it should instead propagate the negative error code from winbond_sio_enter().

Fixes a0d65009411c ("gpio: winbond: Add driver")
---
 drivers/gpio/gpio-winbond.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpio/gpio-winbond.c +4 -4
index 7f8f5b02e31d..4b61d975cc0e 100644
@@ -385,12 +385,13 @@ static int winbond_gpio_get(struct gpio_chip *gc, unsigned int offset)
        unsigned long *base = gpiochip_get_data(gc);
        const struct winbond_gpio_info *info;
        bool val;
+       int ret;
 
        winbond_gpio_get_info(&offset, &info);
 
-       val = winbond_sio_enter(*base);
-       if (val)
-               return val;
+       ret = winbond_sio_enter(*base);
+       if (ret)
+               return ret;
 
        winbond_sio_select_logical(*base, info->dev);
 
--
Quoted 2 lines

2.35.1

Applied, thanks!

Bart