diff options
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index f9ac9a87ffab..6a3893acfe04 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -483,10 +483,12 @@ static int e1000_get_eeprom(struct net_device *netdev, | |||
483 | last_word - first_word + 1, | 483 | last_word - first_word + 1, |
484 | eeprom_buff); | 484 | eeprom_buff); |
485 | else { | 485 | else { |
486 | for (i = 0; i < last_word - first_word + 1; i++) | 486 | for (i = 0; i < last_word - first_word + 1; i++) { |
487 | if ((ret_val = e1000_read_eeprom(hw, first_word + i, 1, | 487 | ret_val = e1000_read_eeprom(hw, first_word + i, 1, |
488 | &eeprom_buff[i]))) | 488 | &eeprom_buff[i]); |
489 | if (ret_val) | ||
489 | break; | 490 | break; |
491 | } | ||
490 | } | 492 | } |
491 | 493 | ||
492 | /* Device's eeprom is always little-endian, word addressable */ | 494 | /* Device's eeprom is always little-endian, word addressable */ |
@@ -669,9 +671,11 @@ static int e1000_set_ringparam(struct net_device *netdev, | |||
669 | 671 | ||
670 | if (netif_running(adapter->netdev)) { | 672 | if (netif_running(adapter->netdev)) { |
671 | /* Try to get new resources before deleting old */ | 673 | /* Try to get new resources before deleting old */ |
672 | if ((err = e1000_setup_all_rx_resources(adapter))) | 674 | err = e1000_setup_all_rx_resources(adapter); |
675 | if (err) | ||
673 | goto err_setup_rx; | 676 | goto err_setup_rx; |
674 | if ((err = e1000_setup_all_tx_resources(adapter))) | 677 | err = e1000_setup_all_tx_resources(adapter); |
678 | if (err) | ||
675 | goto err_setup_tx; | 679 | goto err_setup_tx; |
676 | 680 | ||
677 | /* save the new, restore the old in order to free it, | 681 | /* save the new, restore the old in order to free it, |
@@ -685,7 +689,8 @@ static int e1000_set_ringparam(struct net_device *netdev, | |||
685 | kfree(rx_old); | 689 | kfree(rx_old); |
686 | adapter->rx_ring = rxdr; | 690 | adapter->rx_ring = rxdr; |
687 | adapter->tx_ring = txdr; | 691 | adapter->tx_ring = txdr; |
688 | if ((err = e1000_up(adapter))) | 692 | err = e1000_up(adapter); |
693 | if (err) | ||
689 | goto err_setup; | 694 | goto err_setup; |
690 | } | 695 | } |
691 | 696 | ||
@@ -1057,17 +1062,17 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1057 | if (!txdr->count) | 1062 | if (!txdr->count) |
1058 | txdr->count = E1000_DEFAULT_TXD; | 1063 | txdr->count = E1000_DEFAULT_TXD; |
1059 | 1064 | ||
1060 | if (!(txdr->buffer_info = kcalloc(txdr->count, | 1065 | txdr->buffer_info = kcalloc(txdr->count, sizeof(struct e1000_buffer), |
1061 | sizeof(struct e1000_buffer), | 1066 | GFP_KERNEL); |
1062 | GFP_KERNEL))) { | 1067 | if (!txdr->buffer_info) { |
1063 | ret_val = 1; | 1068 | ret_val = 1; |
1064 | goto err_nomem; | 1069 | goto err_nomem; |
1065 | } | 1070 | } |
1066 | 1071 | ||
1067 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); | 1072 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); |
1068 | txdr->size = ALIGN(txdr->size, 4096); | 1073 | txdr->size = ALIGN(txdr->size, 4096); |
1069 | if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, | 1074 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
1070 | &txdr->dma))) { | 1075 | if (!txdr->desc) { |
1071 | ret_val = 2; | 1076 | ret_val = 2; |
1072 | goto err_nomem; | 1077 | goto err_nomem; |
1073 | } | 1078 | } |
@@ -1088,7 +1093,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1088 | struct sk_buff *skb; | 1093 | struct sk_buff *skb; |
1089 | unsigned int size = 1024; | 1094 | unsigned int size = 1024; |
1090 | 1095 | ||
1091 | if (!(skb = alloc_skb(size, GFP_KERNEL))) { | 1096 | skb = alloc_skb(size, GFP_KERNEL); |
1097 | if (!skb) { | ||
1092 | ret_val = 3; | 1098 | ret_val = 3; |
1093 | goto err_nomem; | 1099 | goto err_nomem; |
1094 | } | 1100 | } |
@@ -1111,15 +1117,16 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1111 | if (!rxdr->count) | 1117 | if (!rxdr->count) |
1112 | rxdr->count = E1000_DEFAULT_RXD; | 1118 | rxdr->count = E1000_DEFAULT_RXD; |
1113 | 1119 | ||
1114 | if (!(rxdr->buffer_info = kcalloc(rxdr->count, | 1120 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), |
1115 | sizeof(struct e1000_buffer), | 1121 | GFP_KERNEL); |
1116 | GFP_KERNEL))) { | 1122 | if (!rxdr->buffer_info) { |
1117 | ret_val = 4; | 1123 | ret_val = 4; |
1118 | goto err_nomem; | 1124 | goto err_nomem; |
1119 | } | 1125 | } |
1120 | 1126 | ||
1121 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); | 1127 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); |
1122 | if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { | 1128 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1129 | if (!rxdr->desc) { | ||
1123 | ret_val = 5; | 1130 | ret_val = 5; |
1124 | goto err_nomem; | 1131 | goto err_nomem; |
1125 | } | 1132 | } |
@@ -1142,8 +1149,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1142 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); | 1149 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); |
1143 | struct sk_buff *skb; | 1150 | struct sk_buff *skb; |
1144 | 1151 | ||
1145 | if (!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, | 1152 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); |
1146 | GFP_KERNEL))) { | 1153 | if (!skb) { |
1147 | ret_val = 6; | 1154 | ret_val = 6; |
1148 | goto err_nomem; | 1155 | goto err_nomem; |
1149 | } | 1156 | } |
@@ -1564,9 +1571,11 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) | |||
1564 | goto out; | 1571 | goto out; |
1565 | } | 1572 | } |
1566 | 1573 | ||
1567 | if ((*data = e1000_setup_desc_rings(adapter))) | 1574 | *data = e1000_setup_desc_rings(adapter); |
1575 | if (*data) | ||
1568 | goto out; | 1576 | goto out; |
1569 | if ((*data = e1000_setup_loopback_test(adapter))) | 1577 | *data = e1000_setup_loopback_test(adapter); |
1578 | if (*data) | ||
1570 | goto err_loopback; | 1579 | goto err_loopback; |
1571 | *data = e1000_run_loopback_test(adapter); | 1580 | *data = e1000_run_loopback_test(adapter); |
1572 | e1000_loopback_cleanup(adapter); | 1581 | e1000_loopback_cleanup(adapter); |