diff mbox

[1/2] gpio: rcar: Fix error path for devm_kzalloc() failure

Message ID 1421057279-16081-2-git-send-email-geert+renesas@glider.be (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Geert Uytterhoeven Jan. 12, 2015, 10:07 a.m. UTC
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")
---
 drivers/gpio/gpio-rcar.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Linus Walleij Jan. 14, 2015, 1:13 p.m. UTC | #1
On Mon, Jan 12, 2015 at 11:07 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:

> 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")

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 584484e3f1e3cd1d..ca2b6310f8f709d3 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -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);