From patchwork Sat Jun 6 16:25:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atsushi Nemoto X-Patchwork-Id: 28189 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 D13A8B7098 for ; Sun, 7 Jun 2009 02:27:10 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MCyhn-0002LO-VH; Sat, 06 Jun 2009 16:25:16 +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 1MCyhe-00020P-Fd for linux-mtd@lists.infradead.org; Sat, 06 Jun 2009 16:25:13 +0000 Received: from localhost.localdomain (p2187-ipad308funabasi.chiba.ocn.ne.jp [123.217.188.187]) by smtp.mba.ocn.ne.jp (Postfix) with ESMTP id E9919915B; Sun, 7 Jun 2009 01:25:01 +0900 (JST) From: Atsushi Nemoto To: dwmw2@infradead.org Subject: [PATCH] mtd: remove driver-core BUS_ID_SIZE Date: Sun, 7 Jun 2009 01:25:02 +0900 Message-Id: <1244305502-20902-1-git-send-email-anemo@mba.ocn.ne.jp> X-Mailer: git-send-email 1.5.6.5 X-Spam-Score: 0.0 (/) Cc: Kay Sievers , linux-mtd@lists.infradead.org, Greg Kroah-Hartman 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: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Kay Sievers The name size limit is gone from the driver-core, the BUS_ID_SIZE value will be removed. [initial version by kay.sievers, reimplemented by dwmw2, adjusted by anemo] Cc: dwmw2@infradead.org Cc: linux-mtd@lists.infradead.org Cc: Greg Kroah-Hartman Signed-off-by: Kay Sievers Signed-off-by: Atsushi Nemoto --- drivers/mtd/nand/txx9ndfmc.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index 8124792..23f4d1f 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c @@ -64,7 +64,7 @@ struct txx9ndfmc_priv { struct nand_chip chip; struct mtd_info mtd; int cs; - char mtdname[BUS_ID_SIZE + 2]; + const char *mtdname; }; #define MAX_TXX9NDFMC_DEV 4 @@ -334,16 +334,23 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) if (plat->ch_mask != 1) { txx9_priv->cs = i; - sprintf(txx9_priv->mtdname, "%s.%u", - dev_name(&dev->dev), i); + txx9_priv->mtdname = kasprintf(GFP_KERNEL, "%s.%u", + dev_name(&dev->dev), i); + if (!txx9_priv->mtdname) { + kfree(txx9_priv); + dev_err(&dev->dev, + "Unable to allocate MTD name.\n"); + continue; + } } else { txx9_priv->cs = -1; - strcpy(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; } @@ -385,6 +392,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) kfree(drvdata->parts[i]); #endif del_mtd_device(mtd); + kfree(txx9_priv->mtdname); kfree(txx9_priv); } return 0;