Skip to contentSkip to conversation

gpio: ge: fix error code in gef_gpio_probe()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 28, 2015 – Feb 9, 2015

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

PATCH 1/1 gpio: ge: fix error code in gef_gpio_probe()

If kstrdup() fails then we should return -ENOMEM but instead the current code returns success.

drivers/gpio/gpio-ge.c +3 -1
index 6ea9303..07e9b39 100644
@@ -77,8 +77,10 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
 
 	/* Setup pointers to chip functions */
 	bgc->gc.label = kstrdup(pdev->dev.of_node->full_name, GFP_KERNEL);
-	if (!bgc->gc.label)
+	if (!bgc->gc.label) {
+		ret = -ENOMEM;
 		goto err0;
+	}
 
 	bgc->gc.base = -1;
 	bgc->gc.ngpio = (u16)(uintptr_t)of_id->data;
#1 lore raw
Quoted 10 lines · Dan Carpenter

If kstrdup() fails then we should return -ENOMEM but instead the current code returns success.

drivers/gpio/gpio-ge.c +0 -0
index 6ea9303..07e9b39 100644

drivers/gpio/gpio-ge.c static int __init gef_gpio_probe(struct platform_device *pdev) · line 83

Quoted 8 lines
drivers/gpio/gpio-ge.c +3 -1
@@ -77,8 +77,10 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
 
        /* Setup pointers to chip functions */
        bgc->gc.label = kstrdup(pdev->dev.of_node->full_name, GFP_KERNEL);
-       if (!bgc->gc.label)
+       if (!bgc->gc.label) {
+               ret = -ENOMEM;
                goto err0;
+       }

This one is already fixed by
http://www.spinics.net/lists/linux-gpio/msg03670.html