aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/jazzsonic.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index a74a5cfaf5bc..2fb3101cb33e 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -285,18 +285,8 @@ static struct device_driver jazz_sonic_driver = {
285 .remove = __devexit_p(jazz_sonic_device_remove), 285 .remove = __devexit_p(jazz_sonic_device_remove),
286}; 286};
287 287
288static void jazz_sonic_platform_release (struct device *device)
289{
290 struct platform_device *pldev;
291
292 /* free device */
293 pldev = to_platform_device (device);
294 kfree (pldev);
295}
296
297static int __init jazz_sonic_init_module(void) 288static int __init jazz_sonic_init_module(void)
298{ 289{
299 struct platform_device *pldev;
300 int err; 290 int err;
301 291
302 if ((err = driver_register(&jazz_sonic_driver))) { 292 if ((err = driver_register(&jazz_sonic_driver))) {
@@ -304,27 +294,19 @@ static int __init jazz_sonic_init_module(void)
304 return err; 294 return err;
305 } 295 }
306 296
307 jazz_sonic_device = NULL; 297 jazz_sonic_device = platform_device_alloc(jazz_sonic_string, 0);
308 298 if (!jazz_sonnic_device)
309 if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) {
310 goto out_unregister; 299 goto out_unregister;
311 }
312 300
313 memset(pldev, 0, sizeof (*pldev)); 301 if (platform_device_add(jazz_sonic_device)) {
314 pldev->name = jazz_sonic_string; 302 platform_device_put(jazz_sonic_device);
315 pldev->id = 0;
316 pldev->dev.release = jazz_sonic_platform_release;
317 jazz_sonic_device = pldev;
318
319 if (platform_device_register (pldev)) {
320 kfree(pldev);
321 jazz_sonic_device = NULL; 303 jazz_sonic_device = NULL;
322 } 304 }
323 305
324 return 0; 306 return 0;
325 307
326out_unregister: 308out_unregister:
327 platform_device_unregister(pldev); 309 driver_unregister(&jazz_sonic_driver);
328 310
329 return -ENOMEM; 311 return -ENOMEM;
330} 312}