diff options
-rw-r--r-- | drivers/net/cxgb4/cxgb4_main.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index 743dc6faec56..653bb546edd3 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -3364,6 +3364,29 @@ static void __devinit print_port_info(struct adapter *adap) | |||
3364 | } | 3364 | } |
3365 | } | 3365 | } |
3366 | 3366 | ||
3367 | /* | ||
3368 | * Free the following resources: | ||
3369 | * - memory used for tables | ||
3370 | * - MSI/MSI-X | ||
3371 | * - net devices | ||
3372 | * - resources FW is holding for us | ||
3373 | */ | ||
3374 | static void free_some_resources(struct adapter *adapter) | ||
3375 | { | ||
3376 | unsigned int i; | ||
3377 | |||
3378 | t4_free_mem(adapter->l2t); | ||
3379 | t4_free_mem(adapter->tids.tid_tab); | ||
3380 | disable_msi(adapter); | ||
3381 | |||
3382 | for_each_port(adapter, i) | ||
3383 | if (adapter->port[i]) | ||
3384 | free_netdev(adapter->port[i]); | ||
3385 | |||
3386 | if (adapter->flags & FW_OK) | ||
3387 | t4_fw_bye(adapter, 0); | ||
3388 | } | ||
3389 | |||
3367 | #define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |\ | 3390 | #define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |\ |
3368 | NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) | 3391 | NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) |
3369 | 3392 | ||
@@ -3564,14 +3587,7 @@ sriov: | |||
3564 | return 0; | 3587 | return 0; |
3565 | 3588 | ||
3566 | out_free_dev: | 3589 | out_free_dev: |
3567 | t4_free_mem(adapter->tids.tid_tab); | 3590 | free_some_resources(adapter); |
3568 | t4_free_mem(adapter->l2t); | ||
3569 | for_each_port(adapter, i) | ||
3570 | if (adapter->port[i]) | ||
3571 | free_netdev(adapter->port[i]); | ||
3572 | if (adapter->flags & FW_OK) | ||
3573 | t4_fw_bye(adapter, 0); | ||
3574 | disable_msi(adapter); | ||
3575 | out_unmap_bar: | 3591 | out_unmap_bar: |
3576 | iounmap(adapter->regs); | 3592 | iounmap(adapter->regs); |
3577 | out_free_adapter: | 3593 | out_free_adapter: |
@@ -3606,16 +3622,8 @@ static void __devexit remove_one(struct pci_dev *pdev) | |||
3606 | 3622 | ||
3607 | if (adapter->flags & FULL_INIT_DONE) | 3623 | if (adapter->flags & FULL_INIT_DONE) |
3608 | cxgb_down(adapter); | 3624 | cxgb_down(adapter); |
3609 | t4_free_mem(adapter->l2t); | ||
3610 | t4_free_mem(adapter->tids.tid_tab); | ||
3611 | disable_msi(adapter); | ||
3612 | |||
3613 | for_each_port(adapter, i) | ||
3614 | if (adapter->port[i]) | ||
3615 | free_netdev(adapter->port[i]); | ||
3616 | 3625 | ||
3617 | if (adapter->flags & FW_OK) | 3626 | free_some_resources(adapter); |
3618 | t4_fw_bye(adapter, 0); | ||
3619 | iounmap(adapter->regs); | 3627 | iounmap(adapter->regs); |
3620 | kfree(adapter); | 3628 | kfree(adapter); |
3621 | pci_disable_pcie_error_reporting(pdev); | 3629 | pci_disable_pcie_error_reporting(pdev); |