Commit 70806a7f authored by Bruce Allan's avatar Bruce Allan Committed by Jeff Kirsher

e1000e: cleanup: do not assign a variable a value when not necessary

Static analysis with cppcheck has shown a few instances of a variable
being reassigned a value before the old one has been used.  None of these
ever require the old value to be used so remove the old values.
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 7dbbe5d5
...@@ -695,7 +695,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) ...@@ -695,7 +695,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw) static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw)
{ {
struct e1000_phy_info *phy = &hw->phy; struct e1000_phy_info *phy = &hw->phy;
s32 ret_val = 0; s32 ret_val;
u16 phy_data, index; u16 phy_data, index;
ret_val = e1e_rphy(hw, GG82563_PHY_DSP_DISTANCE, &phy_data); ret_val = e1e_rphy(hw, GG82563_PHY_DSP_DISTANCE, &phy_data);
...@@ -1276,7 +1276,7 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, ...@@ -1276,7 +1276,7 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
u16 *data) u16 *data)
{ {
u32 kmrnctrlsta; u32 kmrnctrlsta;
s32 ret_val = 0; s32 ret_val;
ret_val = e1000_acquire_mac_csr_80003es2lan(hw); ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
if (ret_val) if (ret_val)
...@@ -1311,7 +1311,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, ...@@ -1311,7 +1311,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
u16 data) u16 data)
{ {
u32 kmrnctrlsta; u32 kmrnctrlsta;
s32 ret_val = 0; s32 ret_val;
ret_val = e1000_acquire_mac_csr_80003es2lan(hw); ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
if (ret_val) if (ret_val)
...@@ -1335,7 +1335,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, ...@@ -1335,7 +1335,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
**/ **/
static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw) static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw)
{ {
s32 ret_val = 0; s32 ret_val;
/* If there's an alternate MAC address place it in RAR0 /* If there's an alternate MAC address place it in RAR0
* so that it will override the Si installed default perm * so that it will override the Si installed default perm
......
...@@ -1397,7 +1397,7 @@ bool e1000_check_phy_82574(struct e1000_hw *hw) ...@@ -1397,7 +1397,7 @@ bool e1000_check_phy_82574(struct e1000_hw *hw)
{ {
u16 status_1kbt = 0; u16 status_1kbt = 0;
u16 receive_errors = 0; u16 receive_errors = 0;
s32 ret_val = 0; s32 ret_val;
/* Read PHY Receive Error counter first, if its is max - all F's then /* Read PHY Receive Error counter first, if its is max - all F's then
* read the Base1000T status register If both are max then PHY is hung. * read the Base1000T status register If both are max then PHY is hung.
...@@ -1542,7 +1542,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) ...@@ -1542,7 +1542,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
ctrl = er32(CTRL); ctrl = er32(CTRL);
status = er32(STATUS); status = er32(STATUS);
rxcw = er32(RXCW); er32(RXCW);
/* SYNCH bit and IV bit are sticky */ /* SYNCH bit and IV bit are sticky */
udelay(10); udelay(10);
rxcw = er32(RXCW); rxcw = er32(RXCW);
...@@ -1812,7 +1812,7 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw) ...@@ -1812,7 +1812,7 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw) static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw)
{ {
if (hw->mac.type == e1000_82571) { if (hw->mac.type == e1000_82571) {
s32 ret_val = 0; s32 ret_val;
/* If there's an alternate MAC address place it in RAR0 /* If there's an alternate MAC address place it in RAR0
* so that it will override the Si installed default perm * so that it will override the Si installed default perm
......
...@@ -1405,7 +1405,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter) ...@@ -1405,7 +1405,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 ctrl = er32(CTRL); u32 ctrl = er32(CTRL);
int link = 0; int link;
/* special requirements for 82571/82572 fiber adapters */ /* special requirements for 82571/82572 fiber adapters */
......
...@@ -485,7 +485,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) ...@@ -485,7 +485,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
{ {
struct e1000_phy_info *phy = &hw->phy; struct e1000_phy_info *phy = &hw->phy;
s32 ret_val = 0; s32 ret_val;
phy->addr = 1; phy->addr = 1;
phy->reset_delay_us = 100; phy->reset_delay_us = 100;
...@@ -783,7 +783,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) ...@@ -783,7 +783,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw)
static s32 __e1000_access_emi_reg_locked(struct e1000_hw *hw, u16 address, static s32 __e1000_access_emi_reg_locked(struct e1000_hw *hw, u16 address,
u16 *data, bool read) u16 *data, bool read)
{ {
s32 ret_val = 0; s32 ret_val;
ret_val = e1e_wphy_locked(hw, I82579_EMI_ADDR, address); ret_val = e1e_wphy_locked(hw, I82579_EMI_ADDR, address);
if (ret_val) if (ret_val)
...@@ -1387,7 +1387,7 @@ static s32 e1000_write_smbus_addr(struct e1000_hw *hw) ...@@ -1387,7 +1387,7 @@ static s32 e1000_write_smbus_addr(struct e1000_hw *hw)
u32 strap = er32(STRAP); u32 strap = er32(STRAP);
u32 freq = (strap & E1000_STRAP_SMT_FREQ_MASK) >> u32 freq = (strap & E1000_STRAP_SMT_FREQ_MASK) >>
E1000_STRAP_SMT_FREQ_SHIFT; E1000_STRAP_SMT_FREQ_SHIFT;
s32 ret_val = 0; s32 ret_val;
strap &= E1000_STRAP_SMBUS_ADDRESS_MASK; strap &= E1000_STRAP_SMBUS_ADDRESS_MASK;
...@@ -1623,7 +1623,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) ...@@ -1623,7 +1623,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
**/ **/
s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
{ {
s32 ret_val = 0; s32 ret_val;
u32 ctrl_reg = 0; u32 ctrl_reg = 0;
u32 ctrl_ext = 0; u32 ctrl_ext = 0;
u32 reg = 0; u32 reg = 0;
...@@ -2284,7 +2284,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) ...@@ -2284,7 +2284,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
**/ **/
static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active) static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
{ {
s32 ret_val = 0; s32 ret_val;
u16 oem_reg; u16 oem_reg;
ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg); ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg);
......
...@@ -165,7 +165,7 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) ...@@ -165,7 +165,7 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
{ {
u32 i; u32 i;
s32 ret_val = 0; s32 ret_val;
u16 offset, nvm_alt_mac_addr_offset, nvm_data; u16 offset, nvm_alt_mac_addr_offset, nvm_data;
u8 alt_mac_addr[ETH_ALEN]; u8 alt_mac_addr[ETH_ALEN];
......
...@@ -3660,8 +3660,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter) ...@@ -3660,8 +3660,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter)
e1e_flush(); e1e_flush();
/* Clear TSYNCRXCTL_VALID & TSYNCTXCTL_VALID bit */ /* Clear TSYNCRXCTL_VALID & TSYNCTXCTL_VALID bit */
regval = er32(RXSTMPH); er32(RXSTMPH);
regval = er32(TXSTMPH); er32(TXSTMPH);
/* Get and set the System Time Register SYSTIM base frequency */ /* Get and set the System Time Register SYSTIM base frequency */
ret_val = e1000e_get_base_timinca(adapter, &regval); ret_val = e1000e_get_base_timinca(adapter, &regval);
...@@ -5834,7 +5834,7 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc) ...@@ -5834,7 +5834,7 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 i, mac_reg; u32 i, mac_reg;
u16 phy_reg, wuc_enable; u16 phy_reg, wuc_enable;
int retval = 0; int retval;
/* copy MAC RARs to PHY RARs */ /* copy MAC RARs to PHY RARs */
e1000_copy_rx_addrs_to_phy_ich8lan(hw); e1000_copy_rx_addrs_to_phy_ich8lan(hw);
......
...@@ -2671,7 +2671,7 @@ s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) ...@@ -2671,7 +2671,7 @@ s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg)
**/ **/
s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg)
{ {
s32 ret_val = 0; s32 ret_val;
/* Select Port Control Registers page */ /* Select Port Control Registers page */
ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT));
...@@ -3103,8 +3103,8 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, ...@@ -3103,8 +3103,8 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
u16 *data, bool read) u16 *data, bool read)
{ {
s32 ret_val; s32 ret_val;
u32 addr_reg = 0; u32 addr_reg;
u32 data_reg = 0; u32 data_reg;
/* This takes care of the difference with desktop vs mobile phy */ /* This takes care of the difference with desktop vs mobile phy */
addr_reg = (hw->phy.type == e1000_phy_82578) ? addr_reg = (hw->phy.type == e1000_phy_82578) ?
......
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