]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: eth: drop device managed netdev registration
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 24 May 2026 08:13:41 +0000 (10:13 +0200)
committerMarkus Stockhausen <markus.stockhausen@gmx.de>
Sat, 30 May 2026 06:50:00 +0000 (08:50 +0200)
The cleanup order of the driver is quite confusing. At least
two issues exist.

- phylink_destroy() is missing
- The implicit unregister_netdev() at the end of rteth_remove() is called
  too late. The manually managed resources are removed before. This can
  lead to stale data access.

Convert to register_netdev() and bring rteth_remove() into a meaningful
order to avoid such issues when converting to page_pool.

Link: https://github.com/openwrt/openwrt/pull/23483
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c

index f5326564307468a39be41f4cc39743c534291369..017a59fdbea4be693e21d5bc5ceda694859d4a58 100644 (file)
@@ -1635,7 +1635,7 @@ static int rteth_probe(struct platform_device *pdev)
                goto cleanup;
        }
 
-       err = devm_register_netdev(&pdev->dev, dev);
+       err = register_netdev(dev);
        if (err)
                goto cleanup;
 
@@ -1656,9 +1656,10 @@ static void rteth_remove(struct platform_device *pdev)
        struct rteth_ctrl *ctrl = netdev_priv(dev);
 
        pr_info("Removing platform driver for rtl838x-eth\n");
-       rteth_hw_stop(ctrl);
+       unregister_netdev(dev);
 
-       netif_tx_stop_all_queues(dev);
+       if (ctrl->phylink)
+               phylink_destroy(ctrl->phylink);
 
        for (int i = 0; i < RTETH_RX_RINGS; i++)
                netif_napi_del(&ctrl->rx_qs[i].napi);