gpio: ge: fix error code in gef_gpio_probe()
Subsystems (2)
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.
Signed-off-by Dan Carpenter <[email protected]>
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; + } bgc->gc.base =-1 ; bgc->gc.ngpio = (u16 )(uintptr_t )of_id->data;
Quoted 10 lines · Dan Carpenter
If
kstrdup()fails then we should return-ENOMEMbut instead the current code returns success.Signed-off-by Dan Carpenter <[email protected]>drivers/gpio/gpio-ge.c +0
-0
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