Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751415AbdHFODl (ORCPT ); Sun, 6 Aug 2017 10:03:41 -0400 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:29501 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751256AbdHFODj (ORCPT ); Sun, 6 Aug 2017 10:03:39 -0400 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 06 Aug 2017 16:03:36 +0200 X-ME-IP: 90.21.163.120 From: Christophe JAILLET To: dwmw2@infradead.org, computersforpeace@gmail.com, boris.brezillon@free-electrons.com, marek.vasut@gmail.com, richard@nod.at, cyrille.pitchen@wedev4u.fr Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] mtd: physmap_of: Fix resources leak in 'of_flash_probe()' Date: Sun, 6 Aug 2017 14:55:01 +0200 Message-Id: <20170806125501.10368-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 922 Lines: 28 If 'of_flash_probe_gemini()' or 'of_flash_probe_versatile()' fail, we must reslease some resources, as already done in all error handling paths in this function. Signed-off-by: Christophe JAILLET --- drivers/mtd/maps/physmap_of_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c index 62fa6836f218..2c8cc97ce019 100644 --- a/drivers/mtd/maps/physmap_of_core.c +++ b/drivers/mtd/maps/physmap_of_core.c @@ -235,10 +235,10 @@ static int of_flash_probe(struct platform_device *dev) err = of_flash_probe_gemini(dev, dp, &info->list[i].map); if (err) - return err; + goto err_out; err = of_flash_probe_versatile(dev, dp, &info->list[i].map); if (err) - return err; + goto err_out; err = -ENOMEM; info->list[i].map.virt = ioremap(info->list[i].map.phys, -- 2.11.0