]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: mscc: ocelot_board: Add of_node_put() before return
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Tue, 16 Jul 2019 05:52:19 +0000 (11:22 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Jul 2019 19:38:17 +0000 (12:38 -0700)
commite685d0e508ef28ad64343915cc1d74bfcd3a8df5
tree93ca9b6b526cafe8d8c4599341ea2c2e5145f1dd
parent3c87e3bbfc78c73020d53031f34bcc8ea9229cb3
net: ethernet: mscc: ocelot_board: Add of_node_put() before return

Each iteration of for_each_available_child_of_node puts the previous
node, but in the case of a return from the middle of the loop, there is
no put, thus causing a memory leak. Hence add an of_node_put before the
return in two places.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot_board.c