aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 0ac2c3d7a2..83f41196a1 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -1332,7 +1332,7 @@ static int ag71xx_probe(struct platform_device *pdev)
if (!np)
return -ENODEV;
- dev = alloc_etherdev(sizeof(*ag));
+ dev = devm_alloc_etherdev(&pdev->dev, sizeof(*ag));
if (!dev)
return -ENOMEM;
@@ -1356,8 +1356,7 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->mac_reset = devm_reset_control_get(&pdev->dev, "mac");
if (IS_ERR(ag->mac_reset)) {
dev_err(&pdev->dev, "missing mac reset\n");
- err = PTR_ERR(ag->mac_reset);
- goto err_free;
+ return PTR_ERR(ag->mac_reset);
}
if (of_property_read_u32_array(np, "fifo-data", ag->fifodata, 3)) {
@@ -1390,18 +1389,15 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->mac_base = devm_ioremap_nocache(&pdev->dev, res->start,
res->end - res->start + 1);
- if (!ag->mac_base) {
- err = -ENOMEM;
- goto err_free;
- }
+ if (!ag->mac_base)
+ return -ENOMEM;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res) {
ag->mii_base = devm_ioremap_nocache(&pdev->dev, res->start,
res->end - res->start + 1);
- if (!ag->mii_base) {
- err = -ENOMEM;
- goto err_free;
- }
+ if (!ag->mii_base)
+ return -ENOMEM;
}
dev->irq = platform_get_irq(pdev, 0);
@@ -1409,7 +1405,7 @@ static int ag71xx_probe(struct platform_device *pdev)
0x0, dev_name(&pdev->dev), dev);
if (err) {
dev_err(&pdev->dev, "unable to request IRQ %d\n", dev->irq);
- goto err_free;
+ return err;
}
dev->netdev_ops = &ag71xx_netdev_ops;
@@ -1460,7 +1456,7 @@ static int ag71xx_probe(struct platform_device *pdev)
sizeof(struct ag71xx_desc),
&ag->stop_desc_dma, GFP_KERNEL);
if (!ag->stop_desc)
- goto err_free;
+ return -ENOMEM;
ag->stop_desc->data = 0;
ag->stop_desc->ctrl = 0;
@@ -1477,8 +1473,7 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->phy_if_mode = of_get_phy_mode(np);
if (ag->phy_if_mode < 0) {
dev_err(&pdev->dev, "missing phy-mode property in DT\n");
- err = ag->phy_if_mode;
- goto err_free;
+ return ag->phy_if_mode;
}
if (of_property_read_u32(np, "qca,mac-idx", &ag->mac_idx))
@@ -1513,7 +1508,7 @@ static int ag71xx_probe(struct platform_device *pdev)
err = ag71xx_phy_connect(ag);
if (err)
- goto err_free;
+ return err;
err = ag71xx_debugfs_init(ag);
if (err)
@@ -1537,8 +1532,6 @@ static int ag71xx_probe(struct platform_device *pdev)
err_phy_disconnect:
ag71xx_phy_disconnect(ag);
-err_free:
- free_netdev(dev);
return err;
}
@@ -1554,11 +1547,7 @@ static int ag71xx_remove(struct platform_device *pdev)
ag71xx_debugfs_exit(ag);
ag71xx_phy_disconnect(ag);
unregister_netdev(dev);
- free_irq(dev->irq, dev);
- iounmap(ag->mac_base);
- kfree(dev);
platform_set_drvdata(pdev, NULL);
-
return 0;
}