From: David Woodhouse <dwmw2@infradead.org>
To: Kay Sievers <kay.sievers@vrfy.org>, catalin.marinas@arm.com
Cc: Takashi Iwai <tiwai@suse.de>, Greg KH <greg@kroah.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-mtd@lists.infradead.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: BUS_ID_SIZE is going away
Date: Wed, 24 Jun 2009 12:14:55 +0100 [thread overview]
Message-ID: <1245842095.25547.5380.camel@macbook.infradead.org> (raw)
In-Reply-To: <1245832038.2483.3.camel@yio.site>
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 <mach/hardware.h>
#include <asm/system.h>
-#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);
--
dwmw2
next parent reply other threads:[~2009-06-24 11:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1245527124.30962.14.camel@yio.site>
[not found] ` <1245675383.25547.50.camel@macbook.infradead.org>
[not found] ` <1245832038.2483.3.camel@yio.site>
2009-06-24 11:14 ` David Woodhouse [this message]
2009-06-24 12:59 ` BUS_ID_SIZE is going away Catalin Marinas
2009-06-24 14:09 ` David Woodhouse
2009-06-24 14:20 ` Catalin Marinas
2009-06-28 11:47 ` Kay Sievers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245842095.25547.5380.camel@macbook.infradead.org \
--to=dwmw2@infradead.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox