Skip to content

Commit 11a7d5c

Browse files
committed
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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents c9efde1 + 9d724b3 commit 11a7d5c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/net/ethernet/ti/cpsw_new.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ static void cpsw_unregister_ports(struct cpsw_common *cpsw)
14721472

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

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

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

20232022
ret = devm_request_irq(dev, cpsw->irqs_table[1], cpsw_tx_interrupt,
20242023
0, dev_name(dev), cpsw);
20252024
if (ret < 0) {
20262025
dev_err(dev, "error attaching irq (%d)\n", ret);
2027-
goto clean_unregister_netdev;
2026+
goto clean_cpts;
20282027
}
20292028

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

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

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

20662065
clean_unregister_notifiers:
20672066
cpsw_unregister_notifiers(cpsw);
2068-
clean_unregister_netdev:
2069-
cpsw_unregister_ports(cpsw);
20702067
clean_cpts:
20712068
cpts_release(cpsw->cpts);
20722069
cpdma_ctlr_destroy(cpsw->dma);

0 commit comments

Comments
 (0)