gpio: ge: fix error code in gef_gpio_probe()
diff mbox

Message ID 20150128191320.GB10259@mwanda
State New
Headers show

Commit Message

Dan Carpenter Jan. 28, 2015, 7:13 p.m. UTC
If kstrdup() fails then we should return -ENOMEM but instead the current
code returns success.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Alexandre Courbot Feb. 9, 2015, 5:29 a.m. UTC | #1
On Thu, Jan 29, 2015 at 4:13 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> If kstrdup() fails then we should return -ENOMEM but instead the current
> code returns success.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
> index 6ea9303..07e9b39 100644
> --- a/drivers/gpio/gpio-ge.c
> +++ b/drivers/gpio/gpio-ge.c
> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index 6ea9303..07e9b39 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -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;