From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 05/11] kni: eliminate unnecessary return variables
Date: Fri, 24 Jul 2015 10:06:18 -0700 [thread overview]
Message-ID: <1437757584-15502-6-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1437757584-15502-1-git-send-email-stephen@networkplumber.org>
If function just sets a variable (and never changes it) and then
returns that value, just move the constant to return.
Found with returnvar.cocci
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c | 16 +++++-----------
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 9 ++++-----
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
index b8c9a13..e3a874b 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
@@ -876,7 +876,6 @@ out:
static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
{
struct e1000_phy_info *phy = &hw->phy;
- s32 ret_val = E1000_SUCCESS;
u32 data;
DEBUGFUNC("e1000_set_d0_lplu_state_82580");
@@ -904,7 +903,7 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
}
E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data);
- return ret_val;
+ return E1000_SUCCESS;
}
/**
@@ -924,7 +923,6 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
{
struct e1000_phy_info *phy = &hw->phy;
- s32 ret_val = E1000_SUCCESS;
u32 data;
DEBUGFUNC("e1000_set_d3_lplu_state_82580");
@@ -952,7 +950,7 @@ s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
}
E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data);
- return ret_val;
+ return E1000_SUCCESS;
}
/**
@@ -1112,7 +1110,6 @@ static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw)
{
s32 timeout = PHY_CFG_TIMEOUT;
- s32 ret_val = E1000_SUCCESS;
u32 mask = E1000_NVM_CFG_DONE_PORT_0;
DEBUGFUNC("e1000_get_cfg_done_82575");
@@ -1137,7 +1134,7 @@ static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw)
(hw->phy.type == e1000_phy_igp_3))
e1000_phy_init_script_igp3(hw);
- return ret_val;
+ return E1000_SUCCESS;
}
/**
@@ -2786,7 +2783,6 @@ s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data)
**/
s32 e1000_set_eee_i350(struct e1000_hw *hw)
{
- s32 ret_val = E1000_SUCCESS;
u32 ipcnfg, eeer;
DEBUGFUNC("e1000_set_eee_i350");
@@ -2818,8 +2814,7 @@ s32 e1000_set_eee_i350(struct e1000_hw *hw)
E1000_READ_REG(hw, E1000_IPCNFG);
E1000_READ_REG(hw, E1000_EEER);
out:
-
- return ret_val;
+ return E1000_SUCCESS;
}
/**
@@ -2986,7 +2981,6 @@ void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)
**/
s32 e1000_set_i2c_bb(struct e1000_hw *hw)
{
- s32 ret_val = E1000_SUCCESS;
u32 ctrl_ext, i2cparams;
DEBUGFUNC("e1000_set_i2c_bb");
@@ -3003,7 +2997,7 @@ s32 e1000_set_i2c_bb(struct e1000_hw *hw)
E1000_WRITE_REG(hw, E1000_I2CPARAMS, i2cparams);
E1000_WRITE_FLUSH(hw);
- return ret_val;
+ return E1000_SUCCESS;
}
/**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index eed8df6..0c04787 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -1859,7 +1859,6 @@ static s32 igb_enable_mas(struct igb_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
u32 connsw;
- s32 ret_val = E1000_SUCCESS;
connsw = E1000_READ_REG(hw, E1000_CONNSW);
if (hw->phy.media_type == e1000_media_type_copper) {
@@ -1871,7 +1870,7 @@ static s32 igb_enable_mas(struct igb_adapter *adapter)
E1000_WRITE_FLUSH(hw);
} else if (connsw & E1000_CONNSW_SERDESD) {
/* already SerDes, no need to enable anything */
- return ret_val;
+ return E1000_SUCCESS;
} else {
dev_info(pci_dev_to_dev(adapter->pdev),
"%s:MAS: Unable to configure feature, disabling..\n",
@@ -1879,7 +1878,7 @@ static s32 igb_enable_mas(struct igb_adapter *adapter)
adapter->flags &= ~IGB_FLAG_MAS_ENABLE;
}
}
- return ret_val;
+ return E1000_SUCCESS;
}
void igb_reset(struct igb_adapter *adapter)
@@ -2424,14 +2423,14 @@ int igb_init_vmdq_netdevs(struct igb_adapter *adapter)
int igb_remove_vmdq_netdevs(struct igb_adapter *adapter)
{
- int pool, err = 0;
+ int pool;
for (pool = 1; pool < adapter->vmdq_pools; pool++) {
unregister_netdev(adapter->vmdq_netdev[pool-1]);
free_netdev(adapter->vmdq_netdev[pool-1]);
adapter->vmdq_netdev[pool-1] = NULL;
}
- return err;
+ return 0;
}
#endif /* CONFIG_IGB_VMDQ_NETDEV */
--
2.1.4
next prev parent reply other threads:[~2015-07-24 17:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 17:06 [dpdk-dev] [PATCH 00/11] misc cleanup patches Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 01/11] eth: move queue check for rx_queue_count Stephen Hemminger
2015-07-26 13:47 ` Thomas Monjalon
2015-08-03 17:00 ` Zhang, Helin
2015-07-24 17:06 ` [dpdk-dev] [PATCH 02/11] eth: do simple return Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 03/11] kni: remove useless semicolon Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 04/11] eth: remove unnecessary return value Stephen Hemminger
2015-07-24 17:06 ` Stephen Hemminger [this message]
2015-07-24 17:06 ` [dpdk-dev] [PATCH 06/11] pipeline: remove useless cast Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 07/11] lpm: remove useless casts Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 08/11] hash: " Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 09/11] kni: remove useless cast Stephen Hemminger
2015-07-24 17:06 ` [dpdk-dev] [PATCH 10/11] i40e: " Stephen Hemminger
2015-08-03 16:56 ` Zhang, Helin
2015-07-24 17:06 ` [dpdk-dev] [PATCH 11/11] bond: " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437757584-15502-6-git-send-email-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).