aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pxa2xx_sharpsl.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2006-01-10 12:16:12 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-10 12:16:12 -0500
commitb016450f9f603210239e1a91e3c28f17c310dcc7 (patch)
treef98c21ce43fc8826dbd006216db0c70cb3901e0d /drivers/pcmcia/pxa2xx_sharpsl.c
parent49978db4f39950cdaaf967e1aad4a324bdc2e180 (diff)
[ARM] 3250/1: Change pxa2xx PCMCIA drivers to use platform_device_alloc
Patch from Richard Purdie Change mainstone and sharpsl pxa2xx pcmcia drivers to use platform_device_alloc which fixes a memory leak. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia/pxa2xx_sharpsl.c')
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index 12a7244a5ec8..fd3647368955 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -263,30 +263,25 @@ static int __init sharpsl_pcmcia_init(void)
263{ 263{
264 int ret; 264 int ret;
265 265
266 sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs; 266 sharpsl_pcmcia_ops.nr = platform_scoop_config->num_devs;
267 sharpsl_pcmcia_device = kzalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL); 267 sharpsl_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
268
268 if (!sharpsl_pcmcia_device) 269 if (!sharpsl_pcmcia_device)
269 return -ENOMEM; 270 return -ENOMEM;
270 271
271 sharpsl_pcmcia_device->name = "pxa2xx-pcmcia";
272 sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; 272 sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
273 sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev; 273 sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
274
275 ret = platform_device_add(sharpsl_pcmcia_device);
274 276
275 ret = platform_device_register(sharpsl_pcmcia_device);
276 if (ret) 277 if (ret)
277 kfree(sharpsl_pcmcia_device); 278 platform_device_put(sharpsl_pcmcia_device);
278 279
279 return ret; 280 return ret;
280} 281}
281 282
282static void __exit sharpsl_pcmcia_exit(void) 283static void __exit sharpsl_pcmcia_exit(void)
283{ 284{
284 /*
285 * This call is supposed to free our sharpsl_pcmcia_device.
286 * Unfortunately platform_device don't have a free method, and
287 * we can't assume it's free of any reference at this point so we
288 * can't free it either.
289 */
290 platform_device_unregister(sharpsl_pcmcia_device); 285 platform_device_unregister(sharpsl_pcmcia_device);
291} 286}
292 287