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>
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[] = {