All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v1 1/4] net: mvpp2: Put fwnode in error case during ->probe()
@ 2021-05-10  9:58 Andy Shevchenko
  2021-05-10  9:58 ` [PATCH net-next v1 2/4] net: mvpp2: Use device_get_match_data() helper Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-05-10  9:58 UTC (permalink / raw)
  To: David S. Miller, netdev, linux-kernel
  Cc: Marcin Wojtas, Russell King, Jakub Kicinski, Andy Shevchenko

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: 248122212f68 ("net: mvpp2: use device_*/fwnode_* APIs instead of of_*")
Cc: Marcin Wojtas <mw@semihalf.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index ec706d614cac..b48c08829a31 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -7552,6 +7552,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])
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-10 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  9:58 [PATCH net-next v1 1/4] net: mvpp2: Put fwnode in error case during ->probe() Andy Shevchenko
2021-05-10  9:58 ` [PATCH net-next v1 2/4] net: mvpp2: Use device_get_match_data() helper Andy Shevchenko
2021-05-10  9:58 ` [PATCH net-next v1 3/4] net: mvpp2: Use devm_clk_get_optional() Andy Shevchenko
2021-05-10  9:58 ` [PATCH net-next v1 4/4] net: mvpp2: Unshadow error code of device_property_read_u32() Andy Shevchenko
2021-05-10 22:20 ` [PATCH net-next v1 1/4] net: mvpp2: Put fwnode in error case during ->probe() patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.