From: Bruce Allan Date: Wed, 8 Feb 2012 02:54:42 +0000 (+0000) Subject: e1000e: cleanup: use goto for common work needed by multiple exit points X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ffacd472c4c577c9d39a97a1f7ac36f59443723b;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git e1000e: cleanup: use goto for common work needed by multiple exit points There are two exit points of e1000e_write_nvm_spi() which require the nvm->ops.release() function pointer called just before exiting. Consolidate the two duplicate pieces of common work with a goto. With this change, the value ret_val will need to be returned instead of 0. Signed-off-by: Bruce Allan Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- diff --git a/drivers/net/ethernet/intel/e1000e/nvm.c b/drivers/net/ethernet/intel/e1000e/nvm.c index f6fb7a768ba5..1b50db59fb0d 100644 --- a/drivers/net/ethernet/intel/e1000e/nvm.c +++ b/drivers/net/ethernet/intel/e1000e/nvm.c @@ -382,10 +382,8 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) u8 write_opcode = NVM_WRITE_OPCODE_SPI; ret_val = e1000_ready_nvm_eeprom(hw); - if (ret_val) { - nvm->ops.release(hw); - return ret_val; - } + if (ret_val) + goto release; e1000_standby_nvm(hw); @@ -422,8 +420,10 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) } usleep_range(10000, 20000); +release: nvm->ops.release(hw); - return 0; + + return ret_val; } /**