realtek: eth: remove false security in rteth_remove()

Check for dev in driver remove gives no additional security. The
remove() function is only called if probe() succeeded. Probing
will always call platform_set_drvdata() in the good case. So
remove() will always find dev data via platform_get_drvdata().

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22610
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Markus Stockhausen 2026-03-25 21:23:35 +01:00 committed by Hauke Mehrtens
parent d56d70fc66
commit 3c38ed380a

View File

@ -1616,15 +1616,13 @@ static void rtl838x_eth_remove(struct platform_device *pdev)
struct net_device *dev = platform_get_drvdata(pdev);
struct rteth_ctrl *ctrl = netdev_priv(dev);
if (dev) {
pr_info("Removing platform driver for rtl838x-eth\n");
rteth_hw_stop(ctrl);
pr_info("Removing platform driver for rtl838x-eth\n");
rteth_hw_stop(ctrl);
netif_tx_stop_all_queues(dev);
netif_tx_stop_all_queues(dev);
for (int i = 0; i < RTETH_RX_RINGS; i++)
netif_napi_del(&ctrl->rx_qs[i].napi);
}
for (int i = 0; i < RTETH_RX_RINGS; i++)
netif_napi_del(&ctrl->rx_qs[i].napi);
}
static const struct of_device_id rteth_of_ids[] = {