mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 17:01:44 +04:00
realtek: eth: drop device managed netdev registration
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user