phy: core: Fix refcount leak bug in of_phy_provider_lookup()
PATCH 1/1 phy: core: Fix refcount leak bug in of_phy_provider_lookup()
We should call of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount.
Fixes 2a4c37016ca9 ("phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node")
Signed-off-by Liang He <[email protected]>
--- drivers/phy/phy-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/phy-core.c +3 -1
@@ -138,8 +138,10 @@ static struct phy_provider *of_phy_provider_lookup(struct device_node *node)return phy_provider;for_each_child_of_node (phy_provider->children, child) -if (child == node) +if (child == node) { +of_node_put (child);return phy_provider; + } }return ERR_PTR (-EPROBE_DEFER );
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy