diff options
| author | Krzysztof Wilczyński <kw@linux.com> | 2021-01-20 18:48:10 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-17 16:43:46 +0100 |
| commit | b63a6e166844dbe64571db7a989d261e4fa6fd4f (patch) | |
| tree | 699971ef7d09b6fa82d102ebeb817e3172ce8f4e /lib | |
| parent | 639f1e04b721814d3fe60e24c86cfffd1516c051 (diff) | |
PCI: mediatek: Add missing of_node_put() to fix reference leak
[ Upstream commit 42814c438aac79746d310f413a27d5b0b959c5de ]
The for_each_available_child_of_node helper internally makes use of the
of_get_next_available_child() which performs an of_node_get() on each
iteration when searching for next available child node.
Should an available child node be found, then it would return a device
node pointer with reference count incremented, thus early return from
the middle of the loop requires an explicit of_node_put() to prevent
reference count leak.
To stop the reference leak, explicitly call of_node_put() before
returning after an error occurred.
Link: https://lore.kernel.org/r/20210120184810.3068794-1-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions
