From patchwork Tue Jun 4 14:44:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 248678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E5AA82C0082 for ; Wed, 5 Jun 2013 00:45:38 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjsUN-0004aH-La; Tue, 04 Jun 2013 14:45:32 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjsUL-0007Nx-Hz; Tue, 04 Jun 2013 14:45:29 +0000 Received: from perches-mx.perches.com ([206.117.179.246] helo=labridge.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjsUJ-0007MG-EC for linux-mtd@lists.infradead.org; Tue, 04 Jun 2013 14:45:27 +0000 Received: from [173.51.221.202] (account joe@perches.com HELO localhost.localdomain) by labridge.com (CommuniGate Pro SMTP 5.0.14) with ESMTPA id 21057927; Tue, 04 Jun 2013 07:45:01 -0700 From: Joe Perches To: linux-kernel@vger.kernel.org Subject: [PATCH 3/4] mtd: onenand: samsung: Release memory after incorrect return/goto Date: Tue, 4 Jun 2013 07:44:49 -0700 Message-Id: X-Mailer: git-send-email 1.8.1.2.459.gbcd45b4.dirty In-Reply-To: <60123fd3175b7cceadf6c335b12e58b797e18f65.1370356776.git.joe@perches.com> References: <60123fd3175b7cceadf6c335b12e58b797e18f65.1370356776.git.joe@perches.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130604_104527_553315_9A97F3E9 X-CRM114-Status: UNSURE ( 8.84 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-mtd@lists.infradead.org, Kyungmin Park , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The code uses return foo; goto err_type; when instead the form should have been ret = foo; goto err_type; Here this causes a useful kfree to be skipped. Signed-off-by: Joe Perches --- drivers/mtd/onenand/samsung.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c index 2cf7408..90bd111 100644 --- a/drivers/mtd/onenand/samsung.c +++ b/drivers/mtd/onenand/samsung.c @@ -895,8 +895,8 @@ static int s3c_onenand_probe(struct platform_device *pdev) r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!r) { dev_err(&pdev->dev, "no memory resource defined\n"); - return -ENOENT; - goto ahb_resource_failed; + err = -ENOENT; + goto resource_failed; } onenand->base_res = request_mem_region(r->start, resource_size(r),