net: mscc: ocelot: add missing of_node_put after calling of_get_child_by_name
authorWen Yang <wenyang@linux.alibaba.com>
Sun, 29 Sep 2019 06:54:24 +0000 (14:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2019 08:21:36 +0000 (09:21 +0100)
commit5dd45c1e86a01b6e50969eab91f36a3ed619af61
treeb73e800ab31db07a3f2f75fa77ba0377f5a96ff5
parentda370945277e4ed745a13b767c88e270190a06c3
net: mscc: ocelot: add missing of_node_put after calling of_get_child_by_name

[ Upstream commit d2c50b1cd94528aea8c8e9abb4cce81590f32cc4 ]

of_node_put needs to be called when the device node which is got
from of_get_child_by_name finished using.
In both cases of success and failure, we need to release 'ports',
so clean up the code using goto.

fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mscc/ocelot_board.c