aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/e1000e/manage.c
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2012-02-07 21:55:56 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-02-13 16:30:16 -0500
commit5015e53a4cf0c88977120faede7eb02b0459d90e (patch)
tree1db95348f1fc1c5487f5dbecd01620a680c587c6 /drivers/net/ethernet/intel/e1000e/manage.c
parent2a31b37a8956154df099400ba93cd6898a629c6d (diff)
e1000e: cleanup goto statements to exit points without common work
Per ./Documentation/CodingStyle, goto statements are acceptable for the centralized exiting of functions when there are multiple exit points which share common work such as cleanup. When no common work is required for multiple exit points, the function should just return at these exit points instead of doing an unnecessary jump to a centralized return. This patch cleans up the inappropriate use of goto statements, and removes unnecessary variables (or move to a smaller scope) where possible as a result of the cleanups. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/manage.c')
-rw-r--r--drivers/net/ethernet/intel/e1000e/manage.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/manage.c b/drivers/net/ethernet/intel/e1000e/manage.c
index c54caf6e5801..0d24b13ce763 100644
--- a/drivers/net/ethernet/intel/e1000e/manage.c
+++ b/drivers/net/ethernet/intel/e1000e/manage.c
@@ -140,7 +140,7 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
140 /* No manageability, no filtering */ 140 /* No manageability, no filtering */
141 if (!e1000e_check_mng_mode(hw)) { 141 if (!e1000e_check_mng_mode(hw)) {
142 hw->mac.tx_pkt_filtering = false; 142 hw->mac.tx_pkt_filtering = false;
143 goto out; 143 return hw->mac.tx_pkt_filtering;
144 } 144 }
145 145
146 /* 146 /*
@@ -150,7 +150,7 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
150 ret_val = e1000_mng_enable_host_if(hw); 150 ret_val = e1000_mng_enable_host_if(hw);
151 if (ret_val) { 151 if (ret_val) {
152 hw->mac.tx_pkt_filtering = false; 152 hw->mac.tx_pkt_filtering = false;
153 goto out; 153 return hw->mac.tx_pkt_filtering;
154 } 154 }
155 155
156 /* Read in the header. Length and offset are in dwords. */ 156 /* Read in the header. Length and offset are in dwords. */
@@ -170,16 +170,13 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
170 */ 170 */
171 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { 171 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) {
172 hw->mac.tx_pkt_filtering = true; 172 hw->mac.tx_pkt_filtering = true;
173 goto out; 173 return hw->mac.tx_pkt_filtering;
174 } 174 }
175 175
176 /* Cookie area is valid, make the final check for filtering. */ 176 /* Cookie area is valid, make the final check for filtering. */
177 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { 177 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING))
178 hw->mac.tx_pkt_filtering = false; 178 hw->mac.tx_pkt_filtering = false;
179 goto out;
180 }
181 179
182out:
183 return hw->mac.tx_pkt_filtering; 180 return hw->mac.tx_pkt_filtering;
184} 181}
185 182
@@ -336,12 +333,11 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
336{ 333{
337 u32 manc; 334 u32 manc;
338 u32 fwsm, factps; 335 u32 fwsm, factps;
339 bool ret_val = false;
340 336
341 manc = er32(MANC); 337 manc = er32(MANC);
342 338
343 if (!(manc & E1000_MANC_RCV_TCO_EN)) 339 if (!(manc & E1000_MANC_RCV_TCO_EN))
344 goto out; 340 return false;
345 341
346 if (hw->mac.has_fwsm) { 342 if (hw->mac.has_fwsm) {
347 fwsm = er32(FWSM); 343 fwsm = er32(FWSM);
@@ -349,10 +345,8 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
349 345
350 if (!(factps & E1000_FACTPS_MNGCG) && 346 if (!(factps & E1000_FACTPS_MNGCG) &&
351 ((fwsm & E1000_FWSM_MODE_MASK) == 347 ((fwsm & E1000_FWSM_MODE_MASK) ==
352 (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) { 348 (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT)))
353 ret_val = true; 349 return true;
354 goto out;
355 }
356 } else if ((hw->mac.type == e1000_82574) || 350 } else if ((hw->mac.type == e1000_82574) ||
357 (hw->mac.type == e1000_82583)) { 351 (hw->mac.type == e1000_82583)) {
358 u16 data; 352 u16 data;
@@ -362,16 +356,12 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
362 356
363 if (!(factps & E1000_FACTPS_MNGCG) && 357 if (!(factps & E1000_FACTPS_MNGCG) &&
364 ((data & E1000_NVM_INIT_CTRL2_MNGM) == 358 ((data & E1000_NVM_INIT_CTRL2_MNGM) ==
365 (e1000_mng_mode_pt << 13))) { 359 (e1000_mng_mode_pt << 13)))
366 ret_val = true; 360 return true;
367 goto out;
368 }
369 } else if ((manc & E1000_MANC_SMBUS_EN) && 361 } else if ((manc & E1000_MANC_SMBUS_EN) &&
370 !(manc & E1000_MANC_ASF_EN)) { 362 !(manc & E1000_MANC_ASF_EN)) {
371 ret_val = true; 363 return true;
372 goto out;
373 } 364 }
374 365
375out: 366 return false;
376 return ret_val;
377} 367}