mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
driver core: platform: Respect return code of platform_device_register_full()
The platform_device_register_full() might return an error pointer. If we instantiate platform device which is optional we may simplify the routine at removal stage by simply calling platform_device_unregister(). For now it requires to check parameter for being an error pointer in each caller. To make users' life easier, check for an error pointer inside driver core. Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
186bddb28f
commit
99fef587ff
1 changed files with 2 additions and 2 deletions
|
@ -234,7 +234,7 @@ struct platform_object {
|
|||
*/
|
||||
void platform_device_put(struct platform_device *pdev)
|
||||
{
|
||||
if (pdev)
|
||||
if (!IS_ERR_OR_NULL(pdev))
|
||||
put_device(&pdev->dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(platform_device_put);
|
||||
|
@ -447,7 +447,7 @@ void platform_device_del(struct platform_device *pdev)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (pdev) {
|
||||
if (!IS_ERR_OR_NULL(pdev)) {
|
||||
device_remove_properties(&pdev->dev);
|
||||
device_del(&pdev->dev);
|
||||
|
||||
|
|
Loading…
Reference in a new issue