aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_main.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2008-07-11 18:17:28 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-22 19:39:03 -0400
commitc7be73bc9bfc8a650fe646f484dea5bad3cf92d5 (patch)
treeeda274bf195f4df6ede9d67913165e9176dc717e /drivers/net/e1000/e1000_main.c
parentb11840204f36f9a1e3027033227e17d167e04377 (diff)
e1000: Move assignments in tests before test
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r--drivers/net/e1000/e1000_main.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cb44fded47ed..0de2006e8b97 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -898,22 +898,28 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
898 u16 eeprom_apme_mask = E1000_EEPROM_APME; 898 u16 eeprom_apme_mask = E1000_EEPROM_APME;
899 DECLARE_MAC_BUF(mac); 899 DECLARE_MAC_BUF(mac);
900 900
901 if ((err = pci_enable_device(pdev))) 901 err = pci_enable_device(pdev);
902 if (err)
902 return err; 903 return err;
903 904
904 if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) && 905 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
905 !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) { 906 !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
906 pci_using_dac = 1; 907 pci_using_dac = 1;
907 } else { 908 } else {
908 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) && 909 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
909 (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { 910 if (err) {
910 E1000_ERR("No usable DMA configuration, aborting\n"); 911 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
911 goto err_dma; 912 if (err) {
913 E1000_ERR("No usable DMA configuration, "
914 "aborting\n");
915 goto err_dma;
916 }
912 } 917 }
913 pci_using_dac = 0; 918 pci_using_dac = 0;
914 } 919 }
915 920
916 if ((err = pci_request_regions(pdev, e1000_driver_name))) 921 err = pci_request_regions(pdev, e1000_driver_name);
922 if (err)
917 goto err_pci_reg; 923 goto err_pci_reg;
918 924
919 pci_set_master(pdev); 925 pci_set_master(pdev);
@@ -975,7 +981,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
975 981
976 /* setup the private structure */ 982 /* setup the private structure */
977 983
978 if ((err = e1000_sw_init(adapter))) 984 err = e1000_sw_init(adapter);
985 if (err)
979 goto err_sw_init; 986 goto err_sw_init;
980 987
981 err = -EIO; 988 err = -EIO;
@@ -1182,7 +1189,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1182 netif_stop_queue(netdev); 1189 netif_stop_queue(netdev);
1183 1190
1184 strcpy(netdev->name, "eth%d"); 1191 strcpy(netdev->name, "eth%d");
1185 if ((err = register_netdev(netdev))) 1192 err = register_netdev(netdev);
1193 if (err)
1186 goto err_register; 1194 goto err_register;
1187 1195
1188 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); 1196 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
@@ -4400,7 +4408,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
4400 } 4408 }
4401 4409
4402 for (j = 0; j < adapter->rx_ps_pages; j++) { 4410 for (j = 0; j < adapter->rx_ps_pages; j++) {
4403 if (!(length= le16_to_cpu(rx_desc->wb.upper.length[j]))) 4411 length = le16_to_cpu(rx_desc->wb.upper.length[j]);
4412 if (!length)
4404 break; 4413 break;
4405 pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j], 4414 pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
4406 PAGE_SIZE, PCI_DMA_FROMDEVICE); 4415 PAGE_SIZE, PCI_DMA_FROMDEVICE);
@@ -5153,7 +5162,8 @@ static int e1000_resume(struct pci_dev *pdev)
5153 5162
5154 pci_set_power_state(pdev, PCI_D0); 5163 pci_set_power_state(pdev, PCI_D0);
5155 pci_restore_state(pdev); 5164 pci_restore_state(pdev);
5156 if ((err = pci_enable_device(pdev))) { 5165 err = pci_enable_device(pdev);
5166 if (err) {
5157 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n"); 5167 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
5158 return err; 5168 return err;
5159 } 5169 }
@@ -5162,8 +5172,11 @@ static int e1000_resume(struct pci_dev *pdev)
5162 pci_enable_wake(pdev, PCI_D3hot, 0); 5172 pci_enable_wake(pdev, PCI_D3hot, 0);
5163 pci_enable_wake(pdev, PCI_D3cold, 0); 5173 pci_enable_wake(pdev, PCI_D3cold, 0);
5164 5174
5165 if (netif_running(netdev) && (err = e1000_request_irq(adapter))) 5175 if (netif_running(netdev)) {
5166 return err; 5176 err = e1000_request_irq(adapter);
5177 if (err)
5178 return err;
5179 }
5167 5180
5168 e1000_power_up_phy(adapter); 5181 e1000_power_up_phy(adapter);
5169 e1000_reset(adapter); 5182 e1000_reset(adapter);