e1000e: Remove unused or empty labels
Subsystems (2)
PATCH 1/1 e1000e: Remove unused or empty labels
Remove labels with only return, remove E1000_SUCCESS code and replace with 0. Remove most goto's.
Signed-off-by Auke Kok <[email protected]>
---
drivers/net/e1000e/82571.c | 138 +++++--------- drivers/net/e1000e/defines.h | 1 drivers/net/e1000e/es2lan.c | 162 +++++++---------- drivers/net/e1000e/ich8lan.c | 401 +++++++++++++++++------------------------- drivers/net/e1000e/lib.c | 314 +++++++++++++-------------------- drivers/net/e1000e/netdev.c | 4 drivers/net/e1000e/phy.c | 278 ++++++++++++----------------- 7 files changed, 521 insertions(+), 777 deletions(-)
drivers/net/e1000e/82571.c +52 -86
@@ -67,11 +67,11 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw);static s32 e1000_init_phy_params_82571 (struct e1000_hw *hw) {struct e1000_phy_info *phy = &hw->phy; -s32 ret_val =E1000_SUCCESS ; +s32 ret_val;if (hw->media_type != e1000_media_type_copper) { phy->type = e1000_phy_none; - goto out; +return 0 ; } phy->addr =1 ;
@@ -87,8 +87,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) phy->type = e1000_phy_m88;break ;default : - ret_val = -E1000_ERR_PHY ; - goto out; +return -E1000_ERR_PHY ;break ; }
@@ -99,25 +98,19 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)switch (hw->mac.type) {case e1000_82571:case e1000_82572: -if (phy->id !=IGP01E1000_I_PHY_ID ) { - ret_val = -E1000_ERR_PHY ; - goto out; - } +if (phy->id !=IGP01E1000_I_PHY_ID ) +return -E1000_ERR_PHY ;break ;case e1000_82573: -if (phy->id !=M88E1111_I_PHY_ID ) { - ret_val = -E1000_ERR_PHY ; - goto out; - } +if (phy->id !=M88E1111_I_PHY_ID ) +return -E1000_ERR_PHY ;break ;default : - ret_val = -E1000_ERR_PHY ; - goto out; +return -E1000_ERR_PHY ;break ; } -out: -return ret_val; +return 0 ; }/**
@@ -174,7 +167,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)break ; } -return E1000_SUCCESS ; +return 0 ; }/**
@@ -188,7 +181,6 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac;struct e1000_mac_operations *func = &mac->ops; -s32 ret_val =E1000_SUCCESS ;/* Set media type */ switch (adapter->pdev->device) {
@@ -232,13 +224,11 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) func->get_link_up_info = e1000_get_speed_and_duplex_fiber_serdes;break ;default : - ret_val = -E1000_ERR_CONFIG ; - goto out; +return -E1000_ERR_CONFIG ;break ; } -out: -return ret_val; +return 0 ; }static s32 e1000_get_invariants_82571 (struct e1000_adapter *adapter)
@@ -306,7 +296,7 @@ static s32 e1000_get_invariants_82571(struct e1000_adapter *adapter)break ; } -return E1000_SUCCESS ; +return 0 ; }/**
@@ -319,7 +309,6 @@ static s32 e1000_get_invariants_82571(struct e1000_adapter *adapter)static s32 e1000_get_phy_id_82571 (struct e1000_hw *hw) {struct e1000_phy_info *phy = &hw->phy; -s32 ret_val =E1000_SUCCESS ;switch (hw->mac.type) {case e1000_82571:
@@ -331,14 +320,14 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) phy->id =IGP01E1000_I_PHY_ID ;break ;case e1000_82573: - ret_val =e1000_get_phy_id (hw); +return e1000_get_phy_id (hw);break ;default : - ret_val = -E1000_ERR_PHY ; +return -E1000_ERR_PHY ;break ; } -return ret_val; +return 0 ; }/**
@@ -350,7 +339,6 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)static s32 e1000_get_hw_semaphore_82571 (struct e1000_hw *hw) {u32 swsm; -s32 ret_val =E1000_SUCCESS ;s32 timeout = hw->nvm.word_size +1 ;s32 i =0 ;
@@ -370,12 +358,10 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)/* Release semaphores */ e1000_put_hw_semaphore (hw);hw_dbg (hw,"Driver can't access the NVM\n" ); - ret_val = -E1000_ERR_NVM ; - goto out; +return -E1000_ERR_NVM ; } -out: -return ret_val; +return 0 ; }/**
@@ -410,7 +396,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw) ret_val =e1000_get_hw_semaphore_82571 (hw);if (ret_val) - goto out; +return ret_val;if (hw->mac.type != e1000_82573) ret_val =e1000_acquire_nvm (hw);
@@ -418,7 +404,6 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)if (ret_val)e1000_put_hw_semaphore_82571 (hw); -out:return ret_val; }
@@ -449,7 +434,7 @@ static void e1000_release_nvm_82571(struct e1000_hw *hw)static s32 e1000_write_nvm_82571 (struct e1000_hw *hw,u16 offset,u16 words,u16 *data) { -s32 ret_val =E1000_SUCCESS ; +s32 ret_val;switch (hw->mac.type) {case e1000_82573:
@@ -483,12 +468,12 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw) ret_val =e1000_update_nvm_checksum_generic (hw);if (ret_val) - goto out; +return ret_val;/* If our nvm is an EEPROM, then we're done * otherwise, commit the checksum to the flash NVM. */ if (hw->nvm.type != e1000_nvm_flash_hw) - goto out; +return ret_val;/* Check for pending operations. */ for (i =0 ; i <E1000_FLASH_UPDATES ; i++) {
@@ -497,10 +482,8 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)break ; } -if (i ==E1000_FLASH_UPDATES ) { - ret_val = -E1000_ERR_NVM ; - goto out; - } +if (i ==E1000_FLASH_UPDATES ) +return -E1000_ERR_NVM ;/* Reset the firmware if using STM opcode. */ if ((er32 (FLOP ) &0xFF00 ) ==E1000_STM_OPCODE ) {
@@ -522,13 +505,10 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)break ; } -if (i ==E1000_FLASH_UPDATES ) { - ret_val = -E1000_ERR_NVM ; - goto out; - } +if (i ==E1000_FLASH_UPDATES ) +return -E1000_ERR_NVM ; -out: -return ret_val; +return 0 ; }/**
@@ -573,8 +553,7 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || (words ==0 )) {hw_dbg (hw,"nvm parameter(s) out of bounds\n" ); - ret_val = -E1000_ERR_NVM ; - goto out; +return -E1000_ERR_NVM ; }for (i =0 ; i < words; i++) {
@@ -593,7 +572,6 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,break ; } -out:return ret_val; }
@@ -606,7 +584,6 @@ out:static s32 e1000_get_cfg_done_82571 (struct e1000_hw *hw) {s32 timeout =PHY_CFG_TIMEOUT ; -s32 ret_val =E1000_SUCCESS ;while (timeout) { if (er32(EEMNGCTL) &
@@ -617,12 +594,10 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) }if (!timeout) {hw_dbg (hw,"MNG configuration cycle has not completed.\n" ); - ret_val = -E1000_ERR_RESET ; - goto out; +return -E1000_ERR_RESET ; } -out: -return ret_val; +return 0 ; }/**
@@ -644,20 +619,20 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) ret_val =e1e_rphy (hw,IGP02E1000_PHY_POWER_MGMT , &data);if (ret_val) - goto out; +return ret_val;if (active) { data |=IGP02E1000_PM_D0_LPLU ; ret_val =e1e_wphy (hw,IGP02E1000_PHY_POWER_MGMT , data);if (ret_val) - goto out; +return ret_val;/* When LPLU is enabled, we should disable SmartSpeed */ ret_val =e1e_rphy (hw,IGP01E1000_PHY_PORT_CONFIG , &data); data &= ~IGP01E1000_PSCFR_SMART_SPEED ; ret_val =e1e_wphy (hw,IGP01E1000_PHY_PORT_CONFIG , data);if (ret_val) - goto out; +return ret_val; }else { data &= ~IGP02E1000_PM_D0_LPLU ; ret_val =e1e_wphy (hw,IGP02E1000_PHY_POWER_MGMT , data);
@@ -669,29 +644,28 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) ret_val =e1e_rphy (hw,IGP01E1000_PHY_PORT_CONFIG , &data);if (ret_val) - goto out; +return ret_val; data |=IGP01E1000_PSCFR_SMART_SPEED ; ret_val =e1e_wphy (hw,IGP01E1000_PHY_PORT_CONFIG , data);if (ret_val) - goto out; +return ret_val; }else if (phy->smart_speed == e1000_smart_speed_off) { ret_val =e1e_rphy (hw,IGP01E1000_PHY_PORT_CONFIG , &data);if (ret_val) - goto out; +return ret_val; data &= ~IGP01E1000_PSCFR_SMART_SPEED ; ret_val =e1e_wphy (hw,IGP01E1000_PHY_PORT_CONFIG , data);if (ret_val) - goto out; +return ret_val; } } -out: -return ret_val; +return 0 ; }/**
@@ -762,7 +736,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) ret_val =e1000_get_auto_rd_done (hw);if (ret_val)/* We don't want to continue accessing MAC registers. */ - goto out; +return ret_val;/* Phy configuration from NVM just starts after EECD_AUTO_RD is set. * Need to wait for Phy configuration completion before accessing
@@ -775,8 +749,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)ew32 (IMC ,0xffffffff ); icr =er32 (ICR ); -out: -return ret_val; +return 0 ; }/**
@@ -799,7 +772,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) ret_val =e1000_id_led_init (hw);if (ret_val) {hw_dbg (hw,"Error initializing identification LED\n" ); - goto out; +return ret_val; }/* Disabling VLAN filtering */
@@ -851,7 +824,6 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)*/ e1000_clear_hw_cntrs_82571 (hw); -out:return ret_val; }
@@ -1041,16 +1013,15 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)ew32 (LEDCTL , led_ctrl);break ;default : - ret_val = -E1000_ERR_PHY ; +return -E1000_ERR_PHY ;break ; }if (ret_val) - goto out; +return ret_val; ret_val =e1000_setup_copper_link (hw); -out:return ret_val; }
@@ -1097,7 +1068,7 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) ret_val =e1000_read_nvm (hw,NVM_ID_LED_SETTINGS ,1 , data);if (ret_val) {hw_dbg (hw,"NVM Read Error\n" ); - goto out; +return ret_val; } if (hw->mac.type == e1000_82573 &&
@@ -1107,8 +1078,7 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) *data == ID_LED_RESERVED_FFFF) *data =ID_LED_DEFAULT ; -out: -return ret_val; +return 0 ; }/**
@@ -1135,7 +1105,7 @@ bool e1000_get_laa_state_82571(struct e1000_hw *hw)void e1000_set_laa_state_82571 (struct e1000_hw *hw,bool state) {if (hw->mac.type != e1000_82571) - goto out; +return ; hw->dev_spec.e82571.laa_is_present = state;
@@ -1148,9 +1118,6 @@ void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state)* Eventually the LAA will be in RAR[0] and RAR[14]. */ e1000_rar_set (hw, hw->mac.addr, hw->mac.rar_entry_count -1 ); - -out: -return ; }/**
@@ -1166,18 +1133,18 @@ out:static s32 e1000_fix_nvm_checksum_82571 (struct e1000_hw *hw) {struct e1000_nvm_info *nvm = &hw->nvm; -s32 ret_val =E1000_SUCCESS ; +s32 ret_val;u16 data;if (nvm->type != e1000_nvm_flash_hw) - goto out; +return 0 ;/* Check bit 4 of word 10h. If it is 0, firmware is done updating * 10h-12h. Checksum may need to be fixed. */ ret_val =e1000_read_nvm (hw,0x10 ,1 , &data);if (ret_val) - goto out; +return ret_val;if (!(data &0x10 )) {/* Read 0x23 and check bit 15. This bit is a 1
@@ -1189,19 +1156,18 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)*/ ret_val =e1000_read_nvm (hw,0x23 ,1 , &data);if (ret_val) - goto out; +return ret_val;if (!(data &0x8000 )) { data |=0x8000 ; ret_val =e1000_write_nvm (hw,0x23 ,1 , &data);if (ret_val) - goto out; +return ret_val; ret_val =e1000_update_nvm_checksum (hw); } } -out: -return ret_val; +return 0 ; }/**
drivers/net/e1000e/defines.h +0 -1
@@ -413,7 +413,6 @@#define E1000_RAH_AV 0x80000000/* Receive descriptor valid */ /* Error Codes */ -#define E1000_SUCCESS 0#define E1000_ERR_NVM 1#define E1000_ERR_PHY 2#define E1000_ERR_CONFIG 3
drivers/net/e1000e/es2lan.c +67 -95
547 lines not on this page · raw message
drivers/net/e1000e/ich8lan.c +162 -239
1,086 lines not on this page · raw message
drivers/net/e1000e/lib.c +125 -189
938 lines not on this page · raw message
drivers/net/e1000e/phy.c +113 -165
278 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Jeff Garzik
AppliedQuoted 6 lines · Auke Kok
Remove labels with only return, remove
E1000_SUCCESScode and replace with 0. Remove most goto's.Signed-off-by Auke Kok <[email protected]>---
Quoted 8 lines
drivers/net/e1000e/82571.c | 138 +++++--------- drivers/net/e1000e/defines.h | 1 drivers/net/e1000e/es2lan.c | 162 +++++++---------- drivers/net/e1000e/ich8lan.c | 401 +++++++++++++++++------------------------- drivers/net/e1000e/lib.c | 314 +++++++++++++-------------------- drivers/net/e1000e/netdev.c | 4 drivers/net/e1000e/phy.c | 278 ++++++++++++----------------- 7 files changed, 521 insertions(+), 777 deletions(-)
applied all three patches to #e1000e