phy: renesas: rcar-gen2: Fix memory leak at error paths
commit67ac0ef9cc8103480e51c6a4e9081ac936ff2162
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tue, 28 May 2019 05:04:02 +0000 (28 14:04 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:33:37 +0000 (4 09:33 +0200)
tree89e4147aaee86ca13971c9bbf18a2e369b03948e
parent34db79aefe86f0fbaeae569322c0549a68473c58
phy: renesas: rcar-gen2: Fix memory leak at error paths

[ Upstream commit d4a36e82924d3305a17ac987a510f3902df5a4b2 ]

This patch fixes memory leak at error paths of the probe function.
In for_each_child_of_node, if the loop returns, the driver should
call of_put_node() before returns.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Fixes: 1233f59f745b237 ("phy: Renesas R-Car Gen2 PHY driver")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/phy/phy-rcar-gen2.c