From patchwork Wed Jun 24 11:14:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 29114 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 B41B1B70A7 for ; Wed, 24 Jun 2009 21:19:05 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MJQRS-00088p-Nw; Wed, 24 Jun 2009 11:15:02 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1MJQRR-0007u3-LO for linux-mtd@bombadil.infradead.org; Wed, 24 Jun 2009 11:15:01 +0000 Received: from macbook.infradead.org ([2001:8b0:10b:1:216:eaff:fe05:bbb8]) by casper.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux)) id 1MJQRN-00017u-3O; Wed, 24 Jun 2009 11:14:57 +0000 Subject: Re: BUS_ID_SIZE is going away From: David Woodhouse To: Kay Sievers , catalin.marinas@arm.com In-Reply-To: <1245832038.2483.3.camel@yio.site> References: <1245527124.30962.14.camel@yio.site> <1245675383.25547.50.camel@macbook.infradead.org> <1245832038.2483.3.camel@yio.site> Date: Wed, 24 Jun 2009 12:14:55 +0100 Message-Id: <1245842095.25547.5380.camel@macbook.infradead.org> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 (2.26.2-1.fc11) X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Cc: Takashi Iwai , Greg KH , linux-kernel , James Bottomley , linux-mtd@lists.infradead.org, "David S. Miller" 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 Wed, 2009-06-24 at 10:27 +0200, Kay Sievers wrote: > On Mon, 2009-06-22 at 13:56 +0100, David Woodhouse wrote: > > I have this queued for 2.6.31 but have been on jury duty for the last 2 > > weeks so I'm hoping to get the pull request to Linus today now that I'm > > free. > > The old one is gone, but seems you merged a new one with BUS_ID_SIZE :) > > ./drivers/mtd/maps/integrator-flash.c:#define SUBDEV_NAME_SIZE (BUS_ID_SIZE + 2) Hm, true :) Catalin, can you test the following? Btw, I'm unconvinced by the existing error handling -- if armflash_subdev_probe() fails, it doesn't look like _that_ subdev actually gets cleaned up in the loop at 'subdev_err:'. So we don't release the memory region (and neither do we free the newly-kmalloced name). In fact, do we still need a separate platform device and driver for ARM systems? What does it provide that the physmap driver does (and can) not? diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index b08a798..b9fac5b 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c @@ -42,10 +42,8 @@ #include #include -#define SUBDEV_NAME_SIZE (BUS_ID_SIZE + 2) - struct armflash_subdev_info { - char name[SUBDEV_NAME_SIZE]; + char *name; struct mtd_info *mtd; struct map_info map; struct flash_platform_data *plat; @@ -134,6 +132,8 @@ static void armflash_subdev_remove(struct armflash_subdev_info *subdev) map_destroy(subdev->mtd); if (subdev->map.virt) iounmap(subdev->map.virt); + kfree(subdev->name); + subdev->name = NULL; release_mem_region(subdev->map.phys, subdev->map.size); } @@ -177,11 +177,14 @@ static int armflash_probe(struct platform_device *dev) if (nr == 1) /* No MTD concatenation, just use the default name */ - snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s", - dev_name(&dev->dev)); + subdev->name = kstrdup(dev_name(&dev->dev), GFP_KERNEL); else - snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s-%d", - dev_name(&dev->dev), i); + subdev->name = kasprintf(GFP_KERNEL, "%s-%d", + dev_name(&dev->dev), i); + if (!subdev->name) { + err = -ENOMEM; + break; + } subdev->plat = plat; err = armflash_subdev_probe(subdev, res);