From patchwork Fri Jun 3 05:14:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 98520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CF9EDB6FB0 for ; Fri, 3 Jun 2011 15:14:44 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSMiH-0002r2-7B; Fri, 03 Jun 2011 05:14:25 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QSMiG-00076I-UB; Fri, 03 Jun 2011 05:14:24 +0000 Received: from mail-px0-f171.google.com ([209.85.212.171]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSMiD-00075z-6w for linux-mtd@lists.infradead.org; Fri, 03 Jun 2011 05:14:21 +0000 Received: by pxi7 with SMTP id 7so885013pxi.16 for ; Thu, 02 Jun 2011 22:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:to:cc:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=oP6EH0IMksNxbSuL+3Q+bftVb8xJ7DfAzNbDgLGdCiQ=; b=PWPKqiuPT2THvfEqvKzbGz1TFfbvNDZ1DtO8CcYp0gSk3J3XRpT+BiTM+jGa+uQ3g8 qntKCP69oM+Sbb0C/dJF/GiNmrCpoJG5Y1KjWChTnhaK5frabzQJI7Td8+0K/BzQnbmD gakOt415w8JHvrs2esrdvroeow89XQ5nEJ3CE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=pljodSjzCXBd6cTxL3sykZNe1SPQQHfpeolCy9nKtb+U59//AJ//N8vCPRecz2Ijh4 CRFkOHltSSkHFQNvdK5xOVaIVFkImuCRquB4xinIcZjEyAPjbbelH/Qm9RDf5uSsPMHA dME6zWolsOhkQqjq7+CRl7G0i84OJGzs2L0go= Received: by 10.68.30.39 with SMTP id p7mr658427pbh.34.1307078057633; Thu, 02 Jun 2011 22:14:17 -0700 (PDT) Received: from [59.112.86.40] (59-112-86-40.dynamic.hinet.net [59.112.86.40]) by mx.google.com with ESMTPS id o2sm1158308pbj.65.2011.06.02.22.14.15 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Jun 2011 22:14:17 -0700 (PDT) Subject: [PATCH 1/2] mtd: pxa3xx_nand: fix a memory leak From: Axel Lin To: linux-kernel@vger.kernel.org Date: Fri, 03 Jun 2011 13:14:10 +0800 Message-ID: <1307078050.4167.1.camel@phoenix> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110603_011421_527250_3D5C8320 X-CRM114-Status: GOOD ( 13.21 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is freemail (axel.lin[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.171 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL Cc: Artem Bityutskiy , David Woodhouse , Eric Miao , Haojian Zhuang , linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In pxa3xx_nand_remove, we should call nand_release instead of mtd_device_unregister to properly free bad block table memory and bad block descriptor memory. Signed-off-by: Axel Lin Acked-by: Lei Wen --- drivers/mtd/nand/pxa3xx_nand.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 1fb3b3a..f7040ea 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -1119,7 +1119,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) clk_put(info->clk); if (mtd) { - mtd_device_unregister(mtd); + nand_release(mtd); kfree(mtd); } return 0;