lkml.org 
[lkml]   [2011]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ASoC: fsl: Fix error handling if platform_device_add fails
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
>


\
 
 \ /
  Last update: 2011-09-27 04:25    [W:0.079 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site