net/ice: fix crash on device detach
authorQi Zhang <qi.z.zhang@intel.com>
Wed, 30 Jan 2019 08:23:46 +0000 (16:23 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 13 Feb 2019 12:13:44 +0000 (13:13 +0100)
Fix segment fault when detach a device due to some redundant function
call in ice_dev_uninit.

Fixes: f9cf4f864150 ("net/ice: support device initialization")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
drivers/net/ice/ice_ethdev.c

index 6ab66fa..6b0113b 100644 (file)
@@ -1458,15 +1458,14 @@ ice_dev_close(struct rte_eth_dev *dev)
 
        ice_res_pool_destroy(&pf->msix_pool);
        ice_release_vsi(pf->main_vsi);
-
+       ice_sched_cleanup_all(hw);
+       rte_free(hw->port_info);
        ice_shutdown_all_ctrlq(hw);
 }
 
 static int
 ice_dev_uninit(struct rte_eth_dev *dev)
 {
-       struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
        struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
@@ -1486,11 +1485,6 @@ ice_dev_uninit(struct rte_eth_dev *dev)
        rte_intr_callback_unregister(intr_handle,
                                     ice_interrupt_handler, dev);
 
-       ice_release_vsi(pf->main_vsi);
-       ice_sched_cleanup_all(hw);
-       rte_free(hw->port_info);
-       ice_shutdown_all_ctrlq(hw);
-
        return 0;
 }