From b016450f9f603210239e1a91e3c28f17c310dcc7 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 10 Jan 2006 17:16:12 +0000 Subject: [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 Signed-off-by: Russell King --- drivers/pcmcia/pxa2xx_sharpsl.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers/pcmcia/pxa2xx_sharpsl.c') diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index 12a7244a5ec..fd364736895 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c @@ -263,30 +263,25 @@ static int __init sharpsl_pcmcia_init(void) { int ret; - sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs; - sharpsl_pcmcia_device = kzalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL); + sharpsl_pcmcia_ops.nr = platform_scoop_config->num_devs; + sharpsl_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); + if (!sharpsl_pcmcia_device) return -ENOMEM; - sharpsl_pcmcia_device->name = "pxa2xx-pcmcia"; sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; - sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev; + sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev; + + ret = platform_device_add(sharpsl_pcmcia_device); - ret = platform_device_register(sharpsl_pcmcia_device); if (ret) - kfree(sharpsl_pcmcia_device); + platform_device_put(sharpsl_pcmcia_device); return ret; } static void __exit sharpsl_pcmcia_exit(void) { - /* - * This call is supposed to free our sharpsl_pcmcia_device. - * Unfortunately platform_device don't have a free method, and - * we can't assume it's free of any reference at this point so we - * can't free it either. - */ platform_device_unregister(sharpsl_pcmcia_device); } -- cgit v1.2.3-70-g09d2