aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <[email protected]>2024-01-02 16:10:21 +0300
committerGreg Kroah-Hartman <[email protected]>2024-01-04 17:01:14 +0100
commit87736ae12e1427bb2e6fd11f37b2ff76ed69aa0f (patch)
tree14763efa6783744583bca653a2912f24afb3dc0c
parentcf60af04edfe51fca488246c9959904adb2750fa (diff)
cdx: call of_node_put() on error path
Add a missing call to of_node_put(np) on error. There was a second error path where "np" was NULL, but that situation is impossible. The for_each_compatible_node() loop iterator is always non-NULL. Just deleted that error path. Fixes: 54b406e10f03 ("cdx: Remove cdx controller list from cdx bus system") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Abhijit Gangurde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/cdx/cdx.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
index c0fca63c7434..929fe3d07eee 100644
--- a/drivers/cdx/cdx.c
+++ b/drivers/cdx/cdx.c
@@ -604,12 +604,11 @@ static ssize_t rescan_store(const struct bus_type *bus,
/* Rescan all the devices */
for_each_compatible_node(np, NULL, compat_node_name) {
- if (!np)
- return -EINVAL;
-
pd = of_find_device_by_node(np);
- if (!pd)
+ if (!pd) {
+ of_node_put(np);
return -EINVAL;
+ }
cdx = platform_get_drvdata(pd);
if (cdx && cdx->controller_registered && cdx->ops->scan)