Re: [PATCH] Minor change to platform_device_register_simple prototype

Russell King
2005-12-07T23:21:28Z

On Wed, Dec 07, 2005 at 03:06:15PM -0800, Greg KH wrote:
> On Wed, Dec 07, 2005 at 05:59:24PM -0500, Dmitry Torokhov wrote:
> > Yes, the I can just write:
> >
> > ...
> > err = platform_driver_register(&i8042_driver);
> > if (err)
> > goto err_controller_cleanup;
> >
> > i8042_platform_device = platform_device_alloc("i8042", -1);
> > if (!i8042_platform_device) {
> > err = -ENOMEM;
> > goto err_unregister_driver;
> > }
> >
> > err = platform_device_add(i8042_platform_device);
> > if (err)
> > goto err_free_device;
> > ...
> >
> > if (!have_ports) {
> > err = -ENODEV;
> > goto err_delete_device;
> > }
> >
> > mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
> > return 0;
> >
> > err_delete_device:
> > platform_device_del(i8042_platform_device);
> > err_free_device:
> > platform_device_put(i8042_platform_device);
> > err_unregister_driver:
> > platform_driver_unregister(&i8042_driver);
> > ....
> >
> > As you can see - single cleanup path..
>
> Ok, that's fine with me. Russell, any objections?

None what so ever - that's mostly what I envisioned with the patch
with the _del method. However, I didn't have an existing user for it.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core