mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 09:44:18 +08:00
e1000e: cleanup multiple common exit points
...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>
This commit is contained in:
parent
52a9b23196
commit
9c5e209d4b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user