From patchwork Tue Jun 2 15:09:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atsushi Nemoto X-Patchwork-Id: 28011 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 CBF60B7043 for ; Wed, 3 Jun 2009 01:14:27 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MBVce-00037u-Qa; Tue, 02 Jun 2009 15:09:52 +0000 Received: from mba.ocn.ne.jp ([122.1.235.107] helo=smtp.mba.ocn.ne.jp) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MBVcV-00036j-2D for linux-mtd@lists.infradead.org; Tue, 02 Jun 2009 15:09:50 +0000 Received: from localhost (p7143-ipad205funabasi.chiba.ocn.ne.jp [222.146.102.143]) by smtp.mba.ocn.ne.jp (Postfix) with ESMTP id 879B6AD22; Wed, 3 Jun 2009 00:09:39 +0900 (JST) Date: Wed, 03 Jun 2009 00:09:39 +0900 (JST) Message-Id: <20090603.000939.193875916.anemo@mba.ocn.ne.jp> To: dwmw2@infradead.org Subject: Re: mtd: remove driver-core BUS_ID_SIZE From: Atsushi Nemoto In-Reply-To: <1243604021.19886.152.camel@macbook.infradead.org> References: <1243603308.19886.149.camel@macbook.infradead.org> <1243604021.19886.152.camel@macbook.infradead.org> X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A B746 CA77 FE94 2874 D52F X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F X-Mailer: Mew version 5.2 on Emacs 22.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-Spam-Score: 0.0 (/) Cc: kay.sievers@vrfy.org, linux-mtd@lists.infradead.org, gregkh@suse.de 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 On Fri, 29 May 2009 14:33:41 +0100, David Woodhouse wrote: > > > This might work better. Nemoto-san, can you test and confirm? ... > > kasprintf() might be nicer here? > > True; thanks. (Er, how have I managed not to know that asprintf() > exists, for the last 20-odd years?) > > diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c > index 8124792..5f919e6 100644 Your latest patch with slight fix works fine. Here is diff against your patch. Please fold into it. Thanks. --- Atsushi Nemoto diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index 5f919e6..fa0458e 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c @@ -344,12 +344,13 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) } } else { txx9_priv->cs = -1; - txx9_priv->mtdname = dev_name(&dev->dev); + txx9_priv->mtdname = kstrdup(dev_name(&dev->dev)); } if (plat->wide_mask & (1 << i)) chip->options |= NAND_BUSWIDTH_16; if (nand_scan(mtd, 1)) { + kfree(txx9_priv->mtdname) kfree(txx9_priv); continue; } @@ -391,8 +392,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) kfree(drvdata->parts[i]); #endif del_mtd_device(mtd); - if (txx9_priv->mtdname != dev_name(&dev->dev)) - kfree(txx9_priv->mtdname); + kfree(txx9_priv->mtdname); kfree(txx9_priv); } return 0;