e1000/base: improve error handling
authorJijiang Liu <jijiang.liu@intel.com>
Wed, 18 Jun 2014 10:17:24 +0000 (12:17 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 18 Jun 2014 21:29:18 +0000 (23:29 +0200)
Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
[Thomas: split code drop]

lib/librte_pmd_e1000/e1000/e1000_80003es2lan.c
lib/librte_pmd_e1000/e1000/e1000_82540.c
lib/librte_pmd_e1000/e1000/e1000_82541.c
lib/librte_pmd_e1000/e1000/e1000_82542.c
lib/librte_pmd_e1000/e1000/e1000_82575.c
lib/librte_pmd_e1000/e1000/e1000_i210.c
lib/librte_pmd_e1000/e1000/e1000_ich8lan.c

index 42cb716..86ddb68 100644 (file)
@@ -850,8 +850,10 @@ STATIC s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
        e1000_release_phy_80003es2lan(hw);
 
        /* Disable IBIST slave mode (far-end loopback) */
-       e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
-                                       &kum_reg_data);
+       ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
+                               E1000_KMRNCTRLSTA_INBAND_PARAM, &kum_reg_data);
+       if (ret_val)
+               return ret_val;
        kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
        e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
                                        kum_reg_data);
index 2944f92..d942c47 100644 (file)
@@ -65,7 +65,7 @@ STATIC s32  e1000_read_mac_addr_82540(struct e1000_hw *hw);
 STATIC s32 e1000_init_phy_params_82540(struct e1000_hw *hw)
 {
        struct e1000_phy_info *phy = &hw->phy;
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
 
        phy->addr               = 1;
        phy->autoneg_mask       = AUTONEG_ADVERTISE_SPEED_DEFAULT;
@@ -328,7 +328,7 @@ STATIC s32 e1000_init_hw_82540(struct e1000_hw *hw)
 {
        struct e1000_mac_info *mac = &hw->mac;
        u32 txdctl, ctrl_ext;
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        u16 i;
 
        DEBUGFUNC("e1000_init_hw_82540");
@@ -410,7 +410,7 @@ STATIC s32 e1000_init_hw_82540(struct e1000_hw *hw)
 STATIC s32 e1000_setup_copper_link_82540(struct e1000_hw *hw)
 {
        u32 ctrl;
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        u16 data;
 
        DEBUGFUNC("e1000_setup_copper_link_82540");
@@ -497,7 +497,7 @@ out:
  **/
 STATIC s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        u16 nvm_data;
 
        DEBUGFUNC("e1000_adjust_serdes_amplitude_82540");
@@ -527,7 +527,7 @@ out:
  **/
 STATIC s32 e1000_set_vco_speed_82540(struct e1000_hw *hw)
 {
-       s32  ret_val = E1000_SUCCESS;
+       s32  ret_val;
        u16 default_page = 0;
        u16 phy_data;
 
index dbea387..8440af3 100644 (file)
@@ -83,7 +83,7 @@ STATIC const u16 e1000_igp_cable_length_table[] = {
 STATIC s32 e1000_init_phy_params_82541(struct e1000_hw *hw)
 {
        struct e1000_phy_info *phy = &hw->phy;
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
 
        DEBUGFUNC("e1000_init_phy_params_82541");
 
index 0d5b536..2e06e16 100644 (file)
@@ -316,7 +316,7 @@ STATIC s32 e1000_init_hw_82542(struct e1000_hw *hw)
 STATIC s32 e1000_setup_link_82542(struct e1000_hw *hw)
 {
        struct e1000_mac_info *mac = &hw->mac;
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
 
        DEBUGFUNC("e1000_setup_link_82542");
 
index 549db36..d7af608 100644 (file)
@@ -1979,7 +1979,7 @@ STATIC s32 e1000_reset_init_script_82575(struct e1000_hw *hw)
  **/
 STATIC s32 e1000_read_mac_addr_82575(struct e1000_hw *hw)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
 
        DEBUGFUNC("e1000_read_mac_addr_82575");
 
@@ -2611,7 +2611,7 @@ out:
  **/
 STATIC s32 e1000_validate_nvm_checksum_82580(struct e1000_hw *hw)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        u16 eeprom_regions_count = 1;
        u16 j, nvm_data;
        u16 nvm_offset;
@@ -2751,7 +2751,7 @@ out:
 STATIC s32 __e1000_access_emi_reg(struct e1000_hw *hw, u16 address,
                                  u16 *data, bool read)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
 
        DEBUGFUNC("__e1000_access_emi_reg");
 
index 722877a..883526b 100644 (file)
@@ -635,7 +635,7 @@ s32 e1000_validate_nvm_checksum_i210(struct e1000_hw *hw)
  **/
 s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        u16 checksum = 0;
        u16 i, nvm_data;
 
@@ -714,7 +714,7 @@ bool e1000_get_flash_presence_i210(struct e1000_hw *hw)
  **/
 s32 e1000_update_flash_i210(struct e1000_hw *hw)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        u32 flup;
 
        DEBUGFUNC("e1000_update_flash_i210");
@@ -770,7 +770,7 @@ s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw)
  **/
 STATIC s32 e1000_init_nvm_params_i210(struct e1000_hw *hw)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
        struct e1000_nvm_info *nvm = &hw->nvm;
 
        DEBUGFUNC("e1000_init_nvm_params_i210");
@@ -855,7 +855,7 @@ out:
 STATIC s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address,
                                    u8 dev_addr, u16 *data, bool read)
 {
-       s32 ret_val = E1000_SUCCESS;
+       s32 ret_val;
 
        DEBUGFUNC("__e1000_access_xmdio_reg");
 
index 99ba605..dcce62a 100644 (file)
@@ -619,13 +619,12 @@ STATIC s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
        DEBUGFUNC("e1000_init_nvm_params_ich8lan");
 
        /* Can't read flash registers if the register set isn't mapped. */
+       nvm->type = e1000_nvm_flash_sw;
        if (!hw->flash_address) {
                DEBUGOUT("ERROR: Flash registers not mapped\n");
                return -E1000_ERR_CONFIG;
        }
 
-       nvm->type = e1000_nvm_flash_sw;
-
        gfpreg = E1000_READ_FLASH_REG(hw, ICH_FLASH_GFPREG);
 
        /* sector_X_addr is a "sector"-aligned address (4096 bytes)