static int __init ct82c710_init(void) { int error; error = ct82c710_detect(); if (error) return error; error = platform_driver_register(&ct82c710_driver); if (error) return error; ct82c710_device = platform_device_alloc("ct82c710", -1); if (!ct82c710_device) { error = -ENOMEM; goto err_unregister_driver; } error = platform_device_add_resources(ct82c710_device, &ct82c710_iores, 1); if (error) goto err_free_device; error = platform_device_add(ct82c710_device); if (error) goto err_free_device; return 0; err_free_device: platform_device_put(ct82c710_device); err_unregister_driver: platform_driver_unregister(&ct82c710_driver); return error; }
static int __init ct82c710_init(void) { int error; error = ct82c710_detect(); if (error) return error; error = platform_driver_register(&ct82c710_driver); if (error) return error; ct82c710_device = platform_device_alloc("ct82c710", -1); if (!ct82c710_device) { error = -ENOMEM; goto err_unregister_driver; } error = platform_device_add_resources(ct82c710_device, &ct82c710_iores, 1); if (error) goto err_free_device; error = platform_device_add(ct82c710_device); if (error) goto err_free_device; serio_register_port(ct82c710_port); printk(KERN_INFO "serio: C&T 82c710 mouse port at %#llx irq %d\n", (unsigned long long)CT82C710_DATA, CT82C710_IRQ); return 0; err_free_device: platform_device_put(ct82c710_device); err_unregister_driver: platform_driver_unregister(&ct82c710_driver); return error; }