Skip to content

Commit 60d865b

Browse files
Yang Yingliangrobherring
authored andcommitted
of: property: decrement node refcount in of_fwnode_get_reference_args()
In of_fwnode_get_reference_args(), the refcount of of_args.np has been incremented in the case of successful return from of_parse_phandle_with_args() or of_parse_phandle_with_fixed_args(). Decrement the refcount if of_args is not returned to the caller of of_fwnode_get_reference_args(). Fixes: 3e3119d ("device property: Introduce fwnode_property_get_reference_args") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Sakari Ailus <[email protected]> Reviewed-by: Frank Rowand <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 917c362 commit 60d865b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/of/property.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,10 @@ of_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
993993
nargs, index, &of_args);
994994
if (ret < 0)
995995
return ret;
996-
if (!args)
996+
if (!args) {
997+
of_node_put(of_args.np);
997998
return 0;
999+
}
9981000

9991001
args->nargs = of_args.args_count;
10001002
args->fwnode = of_fwnode_handle(of_args.np);

0 commit comments

Comments
 (0)