From patchwork Thu Jul 30 15:23:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benedikt Spranger X-Patchwork-Id: 30389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 90F21B7B9E for ; Fri, 31 Jul 2009 01:25:43 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MWXTd-0006gE-DG; Thu, 30 Jul 2009 15:23:29 +0000 Received: from www.tglx.de ([62.245.132.106]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1MWXTW-0006fY-OX; Thu, 30 Jul 2009 15:23:27 +0000 Received: from ariane.spranger.biz (p549AF6C3.dip.t-dialin.net [84.154.246.195]) (authenticated bits=0) by www.tglx.de (8.13.8/8.13.8/TGLX-2007100201) with ESMTP id n6UFNBAT009507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 30 Jul 2009 17:23:12 +0200 Date: Thu, 30 Jul 2009 17:23:10 +0200 From: Benedikt Spranger To: linux-mtd@lists.infradead.org Subject: PATCH] MTD/maps: correct cleanup in error case Message-ID: <20090730172310.719ad329@ariane.spranger.biz> Organization: Linutronix GmbH X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.5; i486-pc-linux-gnu) Mime-Version: 1.0 X-Virus-Scanned: clamav-milter 0.95.1 at www.tglx.de X-Virus-Status: Clean X-Spam-Status: No, score=2.0 required=5.0 tests=AWL,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.4 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on www.tglx.de X-Spam-Score: 0.0 (/) Cc: Stoyan Gaydarov , dwmw2@infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 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 From: Benedikt Spranger Date: Thu, 30 Jul 2009 17:03:51 +0200 Subject: [PATCH] MTD/maps: correct cleanup in error case fix a copy and paste error introduced by commit 143070e (mtd: physmap_of: Add multiple regions and concatenation support). info is needed (via drvdata) and freed in of_flash_remove(), therefore drvdata should be set right after allocation. Signed-off-by: Benedikt Spranger --- drivers/mtd/maps/physmap_of.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 39d357b..32b4a5a 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -214,12 +214,12 @@ static int __devinit of_flash_probe(struct of_device *dev, if (!info) goto err_out; + dev_set_drvdata(&dev->dev, info); + mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); - if (!info) + if (!mtd_list) goto err_out; - dev_set_drvdata(&dev->dev, info); - for (i = 0; i < count; i++) { err = -ENXIO; if (of_address_to_resource(dp, i, &res)) {