Skip to contentSkip to conversation

gpio: exar: Fix error return code in gpio_exar_probe()

PATCH In review Wei Yongjun 2 participants 2 messages May 6, 2020 – May 7, 2020

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

PATCH 1/1 gpio: exar: Fix error return code in gpio_exar_probe()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 7ecced0934e5 ("gpio: exar: add a check for the return value of ida_simple_get fails")
---
 drivers/gpio/gpio-exar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-exar.c +3 -1
index da1ef0b1c291..c5c3fa5b519f 100644
@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
 	mutex_init(&exar_gpio->lock);
 
 	index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
-	if (index < 0)
+	if (index < 0) {
+		ret = index;
 		goto err_destroy;
+	}
 
 	sprintf(exar_gpio->name, "exar_gpio%d", index);
 	exar_gpio->gpio_chip.label = exar_gpio->name;
#1 lore raw

śr., 6 maj 2020 o 14:39 Wei Yongjun <[email protected]> napisał(a):

Quoted 19 lines

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 7ecced0934e5 ("gpio: exar: add a check for the return value of ida_simple_get fails")
---
 drivers/gpio/gpio-exar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-exar.c +0 -0
index da1ef0b1c291..c5c3fa5b519f 100644
@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
        mutex_init(&exar_gpio->lock);

drivers/gpio/gpio-exar.c static int gpio_exar_probe(struct platform_device *pdev) · line 157

Quoted 10 lines
drivers/gpio/gpio-exar.c +3 -1
 
        index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
-       if (index < 0)
+       if (index < 0) {
+               ret = index;
                goto err_destroy;
+       }
 
        sprintf(exar_gpio->name, "exar_gpio%d", index);
        exar_gpio->gpio_chip.label = exar_gpio->name;

This is already fixed in my for-current branch.

Bart