Removing KNI interface that has no PCI driver for ethtool support cause
kernel crash.
Fixes:
109febfe58f9 ("net/igb: move PCI device IDs from EAL")
Fixes:
221fba3b987c ("net/ixgbe: move PCI device IDs from EAL")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
if (!dev)
return -ENODEV;
- if (pci_match_id(ixgbe_pci_tbl, dev->pci_dev))
- ixgbe_kni_remove(dev->pci_dev);
- else if (pci_match_id(igb_pci_tbl, dev->pci_dev))
- igb_kni_remove(dev->pci_dev);
+ if (dev->pci_dev) {
+ if (pci_match_id(ixgbe_pci_tbl, dev->pci_dev))
+ ixgbe_kni_remove(dev->pci_dev);
+ else if (pci_match_id(igb_pci_tbl, dev->pci_dev))
+ igb_kni_remove(dev->pci_dev);
+ }
if (dev->net_dev) {
unregister_netdev(dev->net_dev);