gpio: rcar: Fix error path for devm_kzalloc() failure
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 12 Jan 2015 10:07:58 +0000 (11:07 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 15 Jan 2015 16:23:25 +0000 (17:23 +0100)
If the call to devm_kzalloc() fails, nothing must be cleant up.
This was missed before because gpio_rcar_probe() had a "return"
statement after the first "goto err0".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: df0c6c80232f2ad4 ("gpio: rcar: Add minimal runtime PM support")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-rcar.c

index 584484e3f1e3cd1dfe4ef6c99d2f6b9748174019..ca2b6310f8f709d3b19877b3349628d70553a47c 100644 (file)
@@ -372,10 +372,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
        int ret;
 
        p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
-       if (!p) {
-               ret = -ENOMEM;
-               goto err0;
-       }
+       if (!p)
+               return -ENOMEM;
 
        p->pdev = pdev;
        spin_lock_init(&p->lock);