diff options
| author | Yang Yingliang <yangyingliang@huawei.com> | 2022-11-21 10:32:09 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-08 11:18:32 +0100 |
| commit | 171d5fcca1e38b719bfe9b05cf0675f37e1c9d86 (patch) | |
| tree | af1bdf198caf9cb70025d685976376575c285980 /drivers | |
| parent | 24b9633f7db7f4809be7053df1d2e117e7c2de10 (diff) | |
| download | linux-171d5fcca1e38b719bfe9b05cf0675f37e1c9d86.tar.gz linux-171d5fcca1e38b719bfe9b05cf0675f37e1c9d86.tar.bz2 linux-171d5fcca1e38b719bfe9b05cf0675f37e1c9d86.zip | |
of: property: decrement node refcount in of_fwnode_get_reference_args()
[ Upstream commit 60d865bd5a9b15a3961eb1c08bd4155682a3c81e ]
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: 3e3119d3088f ("device property: Introduce fwnode_property_get_reference_args")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Link: https://lore.kernel.org/r/20221121023209.3909759-1-yangyingliang@huawei.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/of/property.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/of/property.c b/drivers/of/property.c index 43720c2de138..13c7e55f5cba 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -918,8 +918,10 @@ of_fwnode_get_reference_args(const struct fwnode_handle *fwnode, nargs, index, &of_args); if (ret < 0) return ret; - if (!args) + if (!args) { + of_node_put(of_args.np); return 0; + } args->nargs = of_args.args_count; args->fwnode = of_fwnode_handle(of_args.np); |
