lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] of: Add missing of_node_put() before return
Date
Fix the following coccicheck error:
drivers/of/platform.c:554:2-23: WARNING: Function for_each_node_by_type
should have of_node_put() before return around line 560.

Early exits from for_each_node_by_type() should decrement the
node reference counter.

Fixes: 52b1b46c39ae ("of: Create platform devices for OF framebuffers")
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
Changelog:
v2:
- Add a missing ';'.
---
drivers/of/platform.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 2dff3a3d137c..1bb895feb06d 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -556,8 +556,10 @@ static int __init of_platform_default_populate_init(void)
!of_get_property(node, "linux,boot-display", NULL))
continue;
dev = of_platform_device_create(node, "of-display", NULL);
- if (WARN_ON(!dev))
+ if (WARN_ON(!dev)) {
+ of_node_put(node);
return -ENOMEM;
+ }
boot_display = node;
break;
}
--
2.35.1
\
 
 \ /
  Last update: 2022-04-22 03:55    [W:0.034 / U:2.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site