Skip to content

Commit

Permalink
net: mvpp2: Put fwnode in error case during ->probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 71f0891 ]

In each iteration fwnode_for_each_available_child_node() bumps a reference
counting of a loop variable followed by dropping in on a next iteration,

Since in error case the loop is broken, we have to drop a reference count
by ourselves. Do it for port_fwnode in error case during ->probe().

Fixes: 2481222 ("net: mvpp2: use device_*/fwnode_* APIs instead of of_*")
Cc: Marcin Wojtas <mw@semihalf.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
andy-shev authored and gregkh committed Jul 14, 2021
1 parent 6d41df7 commit c2e82ed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7589,6 +7589,8 @@ static int mvpp2_probe(struct platform_device *pdev)
return 0;

err_port_probe:
fwnode_handle_put(port_fwnode);

i = 0;
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
if (priv->port_list[i])
Expand Down

0 comments on commit c2e82ed

Please sign in to comment.