2011/9/27 Tabi Timur-B04825 B04825@freescale.com:
Axel Lin wrote:
Call platform_device_put() instead of platform_device_unregister() if platform_device_add() fails.
What's wrong with calling platform_device_unregister()?
/** * platform_device_unregister - unregister a platform-level device * @pdev: platform device we're unregistering * * Unregistration is done in 2 steps. First we release all resources * and remove it from the subsystem, then we drop reference count by * calling platform_device_put(). */
platform_device_unregister() actually calls platform_device_del() and platform_device_put().
If platform_device_add() call fails, we failed to add the platform device to device hierarchy. Thus we can just call platform_device_put() instead.
-- Timur Tabi Linux kernel developer at Freescale