netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: bcmasp: Use common error handling code in bcmasp_probe()
@ 2023-11-05 16:33 Markus Elfring
  2023-11-06 10:02 ` Wojciech Drewek
  2023-11-06 22:58 ` Jakub Kicinski
  0 siblings, 2 replies; 11+ messages in thread
From: Markus Elfring @ 2023-11-05 16:33 UTC (permalink / raw)
  To: Julia Lawall, David S. Miller, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Justin Chen, Paolo Abeni,
	bcm-kernel-feedback-list, netdev, kernel-janitors
  Cc: cocci, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 5 Nov 2023 17:24:01 +0100

Add a jump target so that a bit of exception handling can be better
reused at the end of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 29b04a274d07..675437e44b94 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1304,9 +1304,8 @@ static int bcmasp_probe(struct platform_device *pdev)
 		intf = bcmasp_interface_create(priv, intf_node, i);
 		if (!intf) {
 			dev_err(dev, "Cannot create eth interface %d\n", i);
-			bcmasp_remove_intfs(priv);
 			of_node_put(intf_node);
-			goto of_put_exit;
+			goto remove_intfs;
 		}
 		list_add_tail(&intf->list, &priv->intfs);
 		i++;
@@ -1331,8 +1330,7 @@ static int bcmasp_probe(struct platform_device *pdev)
 			netdev_err(intf->ndev,
 				   "failed to register net_device: %d\n", ret);
 			priv->destroy_wol(priv);
-			bcmasp_remove_intfs(priv);
-			goto of_put_exit;
+			goto remove_intfs;
 		}
 		count++;
 	}
@@ -1342,6 +1340,10 @@ static int bcmasp_probe(struct platform_device *pdev)
 of_put_exit:
 	of_node_put(ports_node);
 	return ret;
+
+remove_intfs:
+	bcmasp_remove_intfs(priv);
+	goto of_put_exit;
 }

 static void bcmasp_remove(struct platform_device *pdev)
--
2.42.0


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

end of thread, other threads:[~2023-11-16 20:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-05 16:33 [PATCH] net: bcmasp: Use common error handling code in bcmasp_probe() Markus Elfring
2023-11-06 10:02 ` Wojciech Drewek
2023-11-06 13:55   ` Markus Elfring
2023-11-06 14:24     ` Wojciech Drewek
2023-11-06 22:58 ` Jakub Kicinski
2023-11-07  6:38   ` Markus Elfring
2023-11-07 18:48     ` Justin Chen
2023-11-08 17:46       ` Florian Fainelli
2023-11-15  9:10         ` [PATCH v2] " Markus Elfring
2023-11-16 19:05           ` Justin Chen
2023-11-16 20:24             ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).