Commit 9c5e209d authored by Bruce Allan's avatar Bruce Allan Committed by David S. Miller

e1000e: cleanup multiple common exit points

...in e1000_update_nvm_checksum_ich8lan().
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 52a9b231
...@@ -1938,18 +1938,14 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) ...@@ -1938,18 +1938,14 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
new_bank_offset = nvm->flash_bank_size; new_bank_offset = nvm->flash_bank_size;
old_bank_offset = 0; old_bank_offset = 0;
ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
if (ret_val) { if (ret_val)
nvm->ops.release(hw); goto release;
goto out;
}
} else { } else {
old_bank_offset = nvm->flash_bank_size; old_bank_offset = nvm->flash_bank_size;
new_bank_offset = 0; new_bank_offset = 0;
ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
if (ret_val) { if (ret_val)
nvm->ops.release(hw); goto release;
goto out;
}
} }
for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { 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) ...@@ -2005,8 +2001,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
if (ret_val) { if (ret_val) {
/* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
e_dbg("Flash commit failed.\n"); e_dbg("Flash commit failed.\n");
nvm->ops.release(hw); goto release;
goto out;
} }
/* /*
...@@ -2017,18 +2012,15 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) ...@@ -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; act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
if (ret_val) { if (ret_val)
nvm->ops.release(hw); goto release;
goto out;
}
data &= 0xBFFF; data &= 0xBFFF;
ret_val = e1000_retry_write_flash_byte_ich8lan(hw, ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
act_offset * 2 + 1, act_offset * 2 + 1,
(u8)(data >> 8)); (u8)(data >> 8));
if (ret_val) { if (ret_val)
nvm->ops.release(hw); goto release;
goto out;
}
/* /*
* And invalidate the previously valid segment by setting * And invalidate the previously valid segment by setting
...@@ -2038,10 +2030,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) ...@@ -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; act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
if (ret_val) { if (ret_val)
nvm->ops.release(hw); goto release;
goto out;
}
/* Great! Everything worked, we can now clear the cached entries. */ /* Great! Everything worked, we can now clear the cached entries. */
for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { 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) ...@@ -2049,14 +2039,17 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
dev_spec->shadow_ram[i].value = 0xFFFF; dev_spec->shadow_ram[i].value = 0xFFFF;
} }
release:
nvm->ops.release(hw); nvm->ops.release(hw);
/* /*
* Reload the EEPROM, or else modifications will not appear * Reload the EEPROM, or else modifications will not appear
* until after the next adapter reset. * until after the next adapter reset.
*/ */
if (!ret_val) {
e1000e_reload_nvm(hw); e1000e_reload_nvm(hw);
msleep(10); msleep(10);
}
out: out:
if (ret_val) if (ret_val)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment