net: altera: Fix refcount leak in altera_tse_mdio_create
authorMiaoqian Lin <linmq006@gmail.com>
Tue, 7 Jun 2022 04:11:43 +0000 (08:11 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:19 +0000 (18:36 +0200)
commite31d9ba169860687dba19bdc8fccbfd34077f655
treee16b41af657d902004d66861ce3c8c487e8816b7
parente6b6f98fc7605c06c0a3baa70f62c534d7b4ce58
net: altera: Fix refcount leak in altera_tse_mdio_create

[ Upstream commit 11ec18b1d8d92b9df307d31950dcba0b3dd7283c ]

Every iteration of for_each_child_of_node() decrements
the reference count of the previous node.
When break from a for_each_child_of_node() loop,
we need to explicitly call of_node_put() on the child node when
not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220607041144.7553-1-linmq006@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/altera/altera_tse_main.c