e1000e: cleanup multiple common exit points
authorBruce Allan <bruce.w.allan@intel.com>
Mon, 10 May 2010 15:00:31 +0000 (15:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 May 2010 06:31:11 +0000 (23:31 -0700)
...in e1000_update_nvm_checksum_ich8lan().

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/e1000e/ich8lan.c

index b8c4dce01a04ece9a4205d4f011823660bf65008..448e12378dbca7cf81b43440d3f3ac02a4a23c14 100644 (file)
@@ -1938,18 +1938,14 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
                new_bank_offset = nvm->flash_bank_size;
                old_bank_offset = 0;
                ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
-               if (ret_val) {
-                       nvm->ops.release(hw);
-                       goto out;
-               }
+               if (ret_val)
+                       goto release;
        } else {
                old_bank_offset = nvm->flash_bank_size;
                new_bank_offset = 0;
                ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
-               if (ret_val) {
-                       nvm->ops.release(hw);
-                       goto out;
-               }
+               if (ret_val)
+                       goto release;
        }
 
        for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
@@ -2005,8 +2001,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
        if (ret_val) {
                /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
                e_dbg("Flash commit failed.\n");
-               nvm->ops.release(hw);
-               goto out;
+               goto release;
        }
 
        /*
@@ -2017,18 +2012,15 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
         */
        act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
        ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
-       if (ret_val) {
-               nvm->ops.release(hw);
-               goto out;
-       }
+       if (ret_val)
+               goto release;
+
        data &= 0xBFFF;
        ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
                                                       act_offset * 2 + 1,
                                                       (u8)(data >> 8));
-       if (ret_val) {
-               nvm->ops.release(hw);
-               goto out;
-       }
+       if (ret_val)
+               goto release;
 
        /*
         * And invalidate the previously valid segment by setting
@@ -2038,10 +2030,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
         */
        act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
        ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
-       if (ret_val) {
-               nvm->ops.release(hw);
-               goto out;
-       }
+       if (ret_val)
+               goto release;
 
        /* Great!  Everything worked, we can now clear the cached entries. */
        for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
@@ -2049,14 +2039,17 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
                dev_spec->shadow_ram[i].value = 0xFFFF;
        }
 
+release:
        nvm->ops.release(hw);
 
        /*
         * Reload the EEPROM, or else modifications will not appear
         * until after the next adapter reset.
         */
-       e1000e_reload_nvm(hw);
-       msleep(10);
+       if (!ret_val) {
+               e1000e_reload_nvm(hw);
+               msleep(10);
+       }
 
 out:
        if (ret_val)