aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pxa2xx_sharpsl.c
diff options
context:
space:
mode:
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