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:
parent
8508bcb42e
commit
934de59abe
@ -1635,7 +1635,7 @@ static int rteth_probe(struct platform_device *pdev)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = devm_register_netdev(&pdev->dev, dev);
|
err = register_netdev(dev);
|
||||||
if (err)
|
if (err)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1656,9 +1656,10 @@ static void rteth_remove(struct platform_device *pdev)
|
|||||||
struct rteth_ctrl *ctrl = netdev_priv(dev);
|
struct rteth_ctrl *ctrl = netdev_priv(dev);
|
||||||
|
|
||||||
pr_info("Removing platform driver for rtl838x-eth\n");
|
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++)
|
for (int i = 0; i < RTETH_RX_RINGS; i++)
|
||||||
netif_napi_del(&ctrl->rx_qs[i].napi);
|
netif_napi_del(&ctrl->rx_qs[i].napi);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user