aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorVasily Averin <vvs@sw.ru>2006-08-28 17:56:22 -0400
committerAuke Kok <juke-jan.h.kok@intel.com>2006-08-28 17:56:22 -0400
commit6dd62ab063ec12bf1343d244d89e09d5c3b79f51 (patch)
tree31a2e5b89a4529c322bd5bf026bdf124f35e644f /drivers/net/e1000
parent401a552b8b318d594fc44d36e3da13ad475a41f7 (diff)
e1000: e1000_probe resources cleanup
Fix resources cleanup in e1000_probe() Signed-off-by: Vasily Averin <vvs@sw.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000_main.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 354d77841611..c273b456d29e 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -695,21 +695,20 @@ e1000_probe(struct pci_dev *pdev,
695 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) && 695 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) &&
696 (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { 696 (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
697 E1000_ERR("No usable DMA configuration, aborting\n"); 697 E1000_ERR("No usable DMA configuration, aborting\n");
698 return err; 698 goto err_dma;
699 } 699 }
700 pci_using_dac = 0; 700 pci_using_dac = 0;
701 } 701 }
702 702
703 if ((err = pci_request_regions(pdev, e1000_driver_name))) 703 if ((err = pci_request_regions(pdev, e1000_driver_name)))
704 return err; 704 goto err_pci_reg;
705 705
706 pci_set_master(pdev); 706 pci_set_master(pdev);
707 707
708 err = -ENOMEM;
708 netdev = alloc_etherdev(sizeof(struct e1000_adapter)); 709 netdev = alloc_etherdev(sizeof(struct e1000_adapter));
709 if (!netdev) { 710 if (!netdev)
710 err = -ENOMEM;
711 goto err_alloc_etherdev; 711 goto err_alloc_etherdev;
712 }
713 712
714 SET_MODULE_OWNER(netdev); 713 SET_MODULE_OWNER(netdev);
715 SET_NETDEV_DEV(netdev, &pdev->dev); 714 SET_NETDEV_DEV(netdev, &pdev->dev);
@@ -724,11 +723,10 @@ e1000_probe(struct pci_dev *pdev,
724 mmio_start = pci_resource_start(pdev, BAR_0); 723 mmio_start = pci_resource_start(pdev, BAR_0);
725 mmio_len = pci_resource_len(pdev, BAR_0); 724 mmio_len = pci_resource_len(pdev, BAR_0);
726 725
726 err = -EIO;
727 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); 727 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
728 if (!adapter->hw.hw_addr) { 728 if (!adapter->hw.hw_addr)
729 err = -EIO;
730 goto err_ioremap; 729 goto err_ioremap;
731 }
732 730
733 for (i = BAR_1; i <= BAR_5; i++) { 731 for (i = BAR_1; i <= BAR_5; i++) {
734 if (pci_resource_len(pdev, i) == 0) 732 if (pci_resource_len(pdev, i) == 0)
@@ -773,6 +771,7 @@ e1000_probe(struct pci_dev *pdev,
773 if ((err = e1000_sw_init(adapter))) 771 if ((err = e1000_sw_init(adapter)))
774 goto err_sw_init; 772 goto err_sw_init;
775 773
774 err = -EIO;
776 /* Flash BAR mapping must happen after e1000_sw_init 775 /* Flash BAR mapping must happen after e1000_sw_init
777 * because it depends on mac_type */ 776 * because it depends on mac_type */
778 if ((adapter->hw.mac_type == e1000_ich8lan) && 777 if ((adapter->hw.mac_type == e1000_ich8lan) &&
@@ -780,13 +779,11 @@ e1000_probe(struct pci_dev *pdev,
780 flash_start = pci_resource_start(pdev, 1); 779 flash_start = pci_resource_start(pdev, 1);
781 flash_len = pci_resource_len(pdev, 1); 780 flash_len = pci_resource_len(pdev, 1);
782 adapter->hw.flash_address = ioremap(flash_start, flash_len); 781 adapter->hw.flash_address = ioremap(flash_start, flash_len);
783 if (!adapter->hw.flash_address) { 782 if (!adapter->hw.flash_address)
784 err = -EIO;
785 goto err_flashmap; 783 goto err_flashmap;
786 }
787 } 784 }
788 785
789 if ((err = e1000_check_phy_reset_block(&adapter->hw))) 786 if (e1000_check_phy_reset_block(&adapter->hw))
790 DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); 787 DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
791 788
792 /* if ksp3, indicate if it's port a being setup */ 789 /* if ksp3, indicate if it's port a being setup */
@@ -829,7 +826,7 @@ e1000_probe(struct pci_dev *pdev,
829 826
830 if (e1000_init_eeprom_params(&adapter->hw)) { 827 if (e1000_init_eeprom_params(&adapter->hw)) {
831 E1000_ERR("EEPROM initialization failed\n"); 828 E1000_ERR("EEPROM initialization failed\n");
832 return -EIO; 829 goto err_eeprom;
833 } 830 }
834 831
835 /* before reading the EEPROM, reset the controller to 832 /* before reading the EEPROM, reset the controller to
@@ -841,7 +838,6 @@ e1000_probe(struct pci_dev *pdev,
841 838
842 if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) { 839 if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
843 DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n"); 840 DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
844 err = -EIO;
845 goto err_eeprom; 841 goto err_eeprom;
846 } 842 }
847 843
@@ -854,7 +850,6 @@ e1000_probe(struct pci_dev *pdev,
854 850
855 if (!is_valid_ether_addr(netdev->perm_addr)) { 851 if (!is_valid_ether_addr(netdev->perm_addr)) {
856 DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); 852 DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
857 err = -EIO;
858 goto err_eeprom; 853 goto err_eeprom;
859 } 854 }
860 855
@@ -963,16 +958,33 @@ e1000_probe(struct pci_dev *pdev,
963 return 0; 958 return 0;
964 959
965err_register: 960err_register:
961 e1000_release_hw_control(adapter);
962err_eeprom:
963 if (!e1000_check_phy_reset_block(&adapter->hw))
964 e1000_phy_hw_reset(&adapter->hw);
965
966 if (adapter->hw.flash_address) 966 if (adapter->hw.flash_address)
967 iounmap(adapter->hw.flash_address); 967 iounmap(adapter->hw.flash_address);
968err_flashmap: 968err_flashmap:
969#ifdef CONFIG_E1000_NAPI
970 for (i = 0; i < adapter->num_rx_queues; i++)
971 dev_put(&adapter->polling_netdev[i]);
972#endif
973
974 kfree(adapter->tx_ring);
975 kfree(adapter->rx_ring);
976#ifdef CONFIG_E1000_NAPI
977 kfree(adapter->polling_netdev);
978#endif
969err_sw_init: 979err_sw_init:
970err_eeprom:
971 iounmap(adapter->hw.hw_addr); 980 iounmap(adapter->hw.hw_addr);
972err_ioremap: 981err_ioremap:
973 free_netdev(netdev); 982 free_netdev(netdev);
974err_alloc_etherdev: 983err_alloc_etherdev:
975 pci_release_regions(pdev); 984 pci_release_regions(pdev);
985err_pci_reg:
986err_dma:
987 pci_disable_device(pdev);
976 return err; 988 return err;
977} 989}
978 990