Commit 11a7d5c1 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-cpsw_new-fix-multiple-issues-in-the-cpsw_probe-error-path'

Kevin Hao says:

====================
net: cpsw_new: Fix multiple issues in the cpsw_probe() error path

These two patches address duplicate or unnecessary netdev unregistration
in the cpsw_probe() error handling path.
====================

Link: https://patch.msgid.link/20260205-cpsw-error-path-v1-0-6e58bae6b299@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents c9efde1e 9d724b34
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -1472,7 +1472,7 @@ static void cpsw_unregister_ports(struct cpsw_common *cpsw)

	for (i = 0; i < cpsw->data.slaves; i++) {
		ndev = cpsw->slaves[i].ndev;
		if (!ndev)
		if (!ndev || ndev->reg_state != NETREG_REGISTERED)
			continue;

		priv = netdev_priv(ndev);
@@ -1494,7 +1494,6 @@ static int cpsw_register_ports(struct cpsw_common *cpsw)
		if (ret) {
			dev_err(cpsw->dev,
				"cpsw: err registering net device%d\n", i);
			cpsw->slaves[i].ndev = NULL;
			break;
		}
	}
@@ -2003,7 +2002,7 @@ static int cpsw_probe(struct platform_device *pdev)
	/* setup netdevs */
	ret = cpsw_create_ports(cpsw);
	if (ret)
		goto clean_unregister_netdev;
		goto clean_cpts;

	/* Grab RX and TX IRQs. Note that we also have RX_THRESHOLD and
	 * MISC IRQs which are always kept disabled with this driver so
@@ -2017,14 +2016,14 @@ static int cpsw_probe(struct platform_device *pdev)
			       0, dev_name(dev), cpsw);
	if (ret < 0) {
		dev_err(dev, "error attaching irq (%d)\n", ret);
		goto clean_unregister_netdev;
		goto clean_cpts;
	}

	ret = devm_request_irq(dev, cpsw->irqs_table[1], cpsw_tx_interrupt,
			       0, dev_name(dev), cpsw);
	if (ret < 0) {
		dev_err(dev, "error attaching irq (%d)\n", ret);
		goto clean_unregister_netdev;
		goto clean_cpts;
	}

	if (!cpsw->cpts)
@@ -2034,7 +2033,7 @@ static int cpsw_probe(struct platform_device *pdev)
			       0, dev_name(&pdev->dev), cpsw);
	if (ret < 0) {
		dev_err(dev, "error attaching misc irq (%d)\n", ret);
		goto clean_unregister_netdev;
		goto clean_cpts;
	}

	/* Enable misc CPTS evnt_pend IRQ */
@@ -2043,7 +2042,7 @@ static int cpsw_probe(struct platform_device *pdev)
skip_cpts:
	ret = cpsw_register_notifiers(cpsw);
	if (ret)
		goto clean_unregister_netdev;
		goto clean_cpts;

	ret = cpsw_register_devlink(cpsw);
	if (ret)
@@ -2065,8 +2064,6 @@ static int cpsw_probe(struct platform_device *pdev)

clean_unregister_notifiers:
	cpsw_unregister_notifiers(cpsw);
clean_unregister_netdev:
	cpsw_unregister_ports(cpsw);
clean_cpts:
	cpts_release(cpsw->cpts);
	cpdma_ctlr_destroy(cpsw->dma);