All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] minor cleanup
@ 2017-01-09 23:30 Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 1/7] bonding, malloc, bitmap: remove useless return Stephen Hemminger
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Mostly things found while inspecting other code.

Stephen Hemminger (7):
  bonding,malloc,bitmap: remove useless return
  ethdev: reduce goto's in attach/detach
  bnx2x: remove useless return's
  kni: remove useless return statements
  i40e: remove useless return
  ixgbe: remove useless return
  igb: remove useless return's

 drivers/net/bnx2x/bnx2x.c                          |  2 -
 drivers/net/bnx2x/bnx2x_ethdev.c                   |  2 -
 drivers/net/bnx2x/elink.c                          |  1 -
 drivers/net/bonding/rte_eth_bond_pmd.c             |  2 +-
 drivers/net/e1000/igb_pf.c                         |  2 -
 drivers/net/i40e/i40e_ethdev_vf.c                  |  3 --
 drivers/net/ixgbe/ixgbe_82599_bypass.c             | 10 ++---
 lib/librte_eal/common/rte_malloc.c                 |  1 -
 .../linuxapp/kni/ethtool/igb/e1000_82575.c         |  4 --
 .../linuxapp/kni/ethtool/igb/e1000_i210.c          |  2 -
 .../linuxapp/kni/ethtool/igb/e1000_mac.c           |  4 --
 .../linuxapp/kni/ethtool/igb/e1000_phy.c           |  1 -
 .../linuxapp/kni/ethtool/igb/igb_ethtool.c         |  3 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |  2 -
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c | 11 +----
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c       |  2 -
 lib/librte_ether/rte_ethdev.c                      | 52 +++++++++-------------
 lib/librte_sched/rte_bitmap.h                      |  2 -
 18 files changed, 29 insertions(+), 77 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] bonding, malloc, bitmap: remove useless return
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 2/7] ethdev: reduce goto's in attach/detach Stephen Hemminger
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

return statements at end of void functions are unnecessary and unwanted.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
 lib/librte_eal/common/rte_malloc.c     | 1 -
 lib/librte_sched/rte_bitmap.h          | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c1796f22..dd9cfa47 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -241,8 +241,8 @@ arp_op_name(uint16_t arp_op, char *buf)
 	default:
 		break;
 	}
+
 	snprintf(buf, sizeof("Unknown"), "%s", "Unknown");
-	return;
 }
 #endif
 #define MaxIPv4String	16
diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
index f4a88352..09970b06 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -232,7 +232,6 @@ rte_malloc_dump_stats(FILE *f, __rte_unused const char *type)
 		fprintf(f, "\tAlloc_count:%u,\n",sock_stats.alloc_count);
 		fprintf(f, "\tFree_count:%u,\n", sock_stats.free_count);
 	}
-	return;
 }
 
 /*
diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
index 010d752c..d432fdfe 100644
--- a/lib/librte_sched/rte_bitmap.h
+++ b/lib/librte_sched/rte_bitmap.h
@@ -453,8 +453,6 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
 	offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;
 	slab1 = bmp->array1 + index1;
 	*slab1 &= ~(1lu << offset1);
-
-	return;
 }
 
 static inline int
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] ethdev: reduce goto's in attach/detach
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 1/7] bonding, malloc, bitmap: remove useless return Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  2017-01-10  8:40   ` Thomas Monjalon
  2017-01-09 23:30 ` [PATCH 3/7] bnx2x: remove useless return's Stephen Hemminger
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Extra goto's to just a return are unnecessary.
Don't do unnecessary initialization. Propgate return value.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_ether/rte_ethdev.c | 52 +++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9dea1f15..2bd7db6d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -419,18 +419,17 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 int
 rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
 {
-	int ret = -1;
 	int current = rte_eth_dev_count();
 	char *name = NULL;
 	char *args = NULL;
+	int ret;
 
-	if ((devargs == NULL) || (port_id == NULL)) {
-		ret = -EINVAL;
-		goto err;
-	}
+	if (devargs == NULL || port_id == NULL)
+		return -EINVAL;
 
 	/* parse devargs, then retrieve device name and args */
-	if (rte_eal_parse_devargs_str(devargs, &name, &args))
+	ret = rte_eal_parse_devargs_str(devargs, &name, &args);
+	if (ret < 0)
 		goto err;
 
 	ret = rte_eal_dev_attach(name, args);
@@ -441,20 +440,18 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
 	if (!rte_eth_dev_count()) {
 		RTE_LOG(ERR, EAL, "No port found for device (%s)\n", name);
 		ret = -1;
-		goto err;
-	}
-
-	/* if nothing happened, there is a bug here, since some driver told us
-	 * it did attach a device, but did not create a port.
-	 */
-	if (current == rte_eth_dev_count()) {
+	} else if (current == rte_eth_dev_count()) {
+		/*
+		 * if nothing happened, there is a bug here, since
+		 * some driver told us it did attach a device, but did
+		 * not create a port.
+		 */
 		ret = -1;
-		goto err;
+	} else {
+		*port_id = eth_dev_last_created_port;
+		ret = 0;
 	}
 
-	*port_id = eth_dev_last_created_port;
-	ret = 0;
-
 err:
 	free(name);
 	free(args);
@@ -465,27 +462,20 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
 int
 rte_eth_dev_detach(uint8_t port_id, char *name)
 {
-	int ret = -1;
+	int ret;
 
-	if (name == NULL) {
-		ret = -EINVAL;
-		goto err;
-	}
+	if (name == NULL)
+		return -EINVAL;
 
 	/* FIXME: move this to eal, once device flags are relocated there */
-	if (rte_eth_dev_is_detachable(port_id))
-		goto err;
+	ret = rte_eth_dev_is_detachable(port_id);
+	if (ret < 0)
+		return ret;
 
 	snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
 		 "%s", rte_eth_devices[port_id].data->name);
-	ret = rte_eal_dev_detach(name);
-	if (ret < 0)
-		goto err;
 
-	return 0;
-
-err:
-	return ret;
+	return rte_eal_dev_detach(name);
 }
 
 static int
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] bnx2x: remove useless return's
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 1/7] bonding, malloc, bitmap: remove useless return Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 2/7] ethdev: reduce goto's in attach/detach Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 4/7] kni: remove useless return statements Stephen Hemminger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Don't need empty return; at end of void function.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x.c        | 2 --
 drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
 drivers/net/bnx2x/elink.c        | 1 -
 3 files changed, 5 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 28566302..38068f6b 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1371,8 +1371,6 @@ static void bnx2x_drain_tx_queues(struct bnx2x_softc *sc)
 			rmb();
 		}
 	}
-
-	return;
 }
 
 static int
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 7140118f..1d38c4bf 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -225,8 +225,6 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)
 		PMD_DRV_LOG(DEBUG, "bnx2x_nic_unload failed (%d)", ret);
 		return;
 	}
-
-	return;
 }
 
 static void
diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c
index 53293962..287869d5 100644
--- a/drivers/net/bnx2x/elink.c
+++ b/drivers/net/bnx2x/elink.c
@@ -10362,7 +10362,6 @@ static void elink_5461x_set_link_led(struct elink_phy *phy,
 	elink_cl22_write(sc, phy,
 			 MDIO_REG_GPHY_SHADOW,
 			 MDIO_REG_GPHY_SHADOW_WR_ENA | temp);
-	return;
 }
 
 static void elink_54618se_link_reset(struct elink_phy *phy,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] kni: remove useless return statements
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
                   ` (2 preceding siblings ...)
  2017-01-09 23:30 ` [PATCH 3/7] bnx2x: remove useless return's Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  2017-01-11 17:36   ` Ferruh Yigit
  2017-01-09 23:30 ` [PATCH 5/7] i40e: remove useless return Stephen Hemminger
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

A return statement at end of void function is unnecessary.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c   |  4 ----
 lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c    |  2 --
 lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c     |  4 ----
 lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c     |  1 -
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c   |  3 +--
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c      |  2 --
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c      | 11 ++---------
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c |  2 --
 8 files changed, 3 insertions(+), 26 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 d558af20..d0f77b11 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c
@@ -1384,8 +1384,6 @@ void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw)
 		E1000_WRITE_FLUSH(hw);
 		msec_delay(1);
 	}
-
-	return;
 }
 
 /**
@@ -2034,8 +2032,6 @@ static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw)
 	/* If the management interface is not enabled, then power down */
 	if (!(e1000_enable_mng_pass_thru(hw) || phy->ops.check_reset_block(hw)))
 		e1000_power_down_phy_copper(hw);
-
-	return;
 }
 
 /**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c
index 7e4c20a9..7b81fa65 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c
@@ -798,8 +798,6 @@ void e1000_init_function_pointers_i210(struct e1000_hw *hw)
 {
 	e1000_init_function_pointers_82575(hw);
 	hw->nvm.ops.init_params = e1000_init_nvm_params_i210;
-
-	return;
 }
 
 /**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c
index 74319def..4e003dea 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c
@@ -90,7 +90,6 @@ s32 e1000_null_ops_generic(struct e1000_hw E1000_UNUSEDARG *hw)
 void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw)
 {
 	DEBUGFUNC("e1000_null_mac_generic");
-	return;
 }
 
 /**
@@ -122,7 +121,6 @@ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw,
 			  u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a)
 {
 	DEBUGFUNC("e1000_null_update_mc");
-	return;
 }
 
 /**
@@ -133,7 +131,6 @@ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw,
 			   u32 E1000_UNUSEDARG a, u32 E1000_UNUSEDARG b)
 {
 	DEBUGFUNC("e1000_null_write_vfta");
-	return;
 }
 
 /**
@@ -144,7 +141,6 @@ void e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw,
 			u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a)
 {
 	DEBUGFUNC("e1000_null_rar_set");
-	return;
 }
 
 /**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c
index d8a77c45..185c14e9 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c
@@ -115,7 +115,6 @@ s32 e1000_null_read_reg(struct e1000_hw E1000_UNUSEDARG *hw,
 void e1000_null_phy_generic(struct e1000_hw E1000_UNUSEDARG *hw)
 {
 	DEBUGFUNC("e1000_null_phy_generic");
-	return;
 }
 
 /**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
index d7a987d5..8a79f386 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
@@ -2415,9 +2415,8 @@ static void igb_get_dmac(struct net_device *netdev,
 			    struct ethtool_value *edata)
 {
 	struct igb_adapter *adapter = netdev_priv(netdev);
-	edata->data = adapter->dmac;
 
-	return;
+	edata->data = adapter->dmac;
 }
 #endif
 
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 f4dca5a3..1f77db2c 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -2492,8 +2492,6 @@ static void igb_set_fw_version(struct igb_adapter *adapter)
 		}
 		break;
 	}
-
-	return;
 }
 
 /**
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c
index 205da562..f48aebb0 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c
@@ -197,8 +197,6 @@ void igb_vmdq_set_rx_mode(struct net_device *dev)
 #endif
 	}
 	E1000_WRITE_REG(hw, E1000_VMOLR(hw_queue), vmolr);
-
-	return;
 }
 
 int igb_vmdq_set_mac(struct net_device *dev, void *p)
@@ -247,9 +245,8 @@ void igb_vmdq_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 
 	igb_enable_vlan_tags(adapter);
 	E1000_WRITE_REG(hw, E1000_VMVIR(hw_queue), 0);
-
-	return;
 }
+
 void igb_vmdq_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
 {
 	struct igb_vmdq_adapter *vadapter = netdev_priv(dev);
@@ -272,9 +269,8 @@ void igb_vmdq_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
 	v_netdev->features |= adapter->netdev->features;
 	vlan_group_set_device(vadapter->vlgrp, vid, v_netdev);
 #endif
-
-	return;
 }
+
 void igb_vmdq_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 {
 	struct igb_vmdq_adapter *vadapter = netdev_priv(dev);
@@ -285,9 +281,6 @@ void igb_vmdq_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 	vlan_group_set_device(vadapter->vlgrp, vid, NULL);
 	/* remove vlan from VLVF table array */
 	igb_vlvf_set(adapter, vid, FALSE, hw_queue);
-
-
-	return;
 }
 
 static int igb_vmdq_get_settings(struct net_device *netdev,
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
index e17b7f18..33a9213f 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
@@ -1291,6 +1291,4 @@ static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
 	/* Setup Tx packet buffer sizes */
 	for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++)
 		IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), IXGBE_TXPBSIZE_40KB);
-
-	return;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] i40e: remove useless return
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
                   ` (3 preceding siblings ...)
  2017-01-09 23:30 ` [PATCH 4/7] kni: remove useless return statements Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 6/7] ixgbe: " Stephen Hemminger
  2017-01-09 23:30 ` [PATCH 7/7] igb: remove useless return's Stephen Hemminger
  6 siblings, 0 replies; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

No need for return at end of void function.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 0dc0af52..482b339c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -882,8 +882,6 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 	if (err)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_ADD_ETHER_ADDRESS");
-
-	return;
 }
 
 static void
@@ -923,7 +921,6 @@ i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 	if (err)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_DEL_ETHER_ADDRESS");
-	return;
 }
 
 static int
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] ixgbe: remove useless return
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
                   ` (4 preceding siblings ...)
  2017-01-09 23:30 ` [PATCH 5/7] i40e: remove useless return Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  2017-02-01 16:40   ` Ananyev, Konstantin
  2017-01-09 23:30 ` [PATCH 7/7] igb: remove useless return's Stephen Hemminger
  6 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

If all goto's lead to a return, then better to get rid of goto.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ixgbe/ixgbe_82599_bypass.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_82599_bypass.c b/drivers/net/ixgbe/ixgbe_82599_bypass.c
index de9fa5a7..af55cc0a 100644
--- a/drivers/net/ixgbe/ixgbe_82599_bypass.c
+++ b/drivers/net/ixgbe/ixgbe_82599_bypass.c
@@ -73,7 +73,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
 					   &eeprom_data);
 	if (status) {
 		PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS0");
-		goto out;
+		return;
 	}
 
 	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
@@ -83,7 +83,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
 					    eeprom_data);
 	if (status) {
 		PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS0");
-		goto out;
+		return;
 	}
 
 	/* Set RS1 */
@@ -92,7 +92,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
 					   &eeprom_data);
 	if (status) {
 		PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS1");
-		goto out;
+		return;
 	}
 
 	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
@@ -102,10 +102,8 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
 					    eeprom_data);
 	if (status) {
 		PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS1");
-		goto out;
+		return;
 	}
-out:
-	return;
 }
 
 /**
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] igb: remove useless return's
  2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
                   ` (5 preceding siblings ...)
  2017-01-09 23:30 ` [PATCH 6/7] ixgbe: " Stephen Hemminger
@ 2017-01-09 23:30 ` Stephen Hemminger
  6 siblings, 0 replies; 13+ messages in thread
From: Stephen Hemminger @ 2017-01-09 23:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/e1000/igb_pf.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 67da3c24..15bf8bfe 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -125,8 +125,6 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
 
 	/* set mb interrupt mask */
 	igb_mb_intr_setup(eth_dev);
-
-	return;
 }
 
 void igb_pf_host_uninit(struct rte_eth_dev *dev)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/7] ethdev: reduce goto's in attach/detach
  2017-01-09 23:30 ` [PATCH 2/7] ethdev: reduce goto's in attach/detach Stephen Hemminger
@ 2017-01-10  8:40   ` Thomas Monjalon
  2017-02-01 17:26     ` Ferruh Yigit
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Monjalon @ 2017-01-10  8:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Hi Stephen,

Please use --in-reply-to to keep v1 and v2 in the same thread.

Comment below


2017-01-09 15:30, Stephen Hemminger:
>  int
>  rte_eth_dev_detach(uint8_t port_id, char *name)
>  {
> -	int ret = -1;
> +	int ret;
>  
> -	if (name == NULL) {
> -		ret = -EINVAL;
> -		goto err;
> -	}
> +	if (name == NULL)
> +		return -EINVAL;
>  
>  	/* FIXME: move this to eal, once device flags are relocated there */
> -	if (rte_eth_dev_is_detachable(port_id))
> -		goto err;
> +	ret = rte_eth_dev_is_detachable(port_id);
> +	if (ret < 0)
> +		return ret;

As commented on v1 by Ferruh and I, you should check also positive value.

>  
>  	snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
>  		 "%s", rte_eth_devices[port_id].data->name);
> -	ret = rte_eal_dev_detach(name);
> -	if (ret < 0)
> -		goto err;
>  
> -	return 0;
> -
> -err:
> -	return ret;
> +	return rte_eal_dev_detach(name);
>  }

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/7] kni: remove useless return statements
  2017-01-09 23:30 ` [PATCH 4/7] kni: remove useless return statements Stephen Hemminger
@ 2017-01-11 17:36   ` Ferruh Yigit
  0 siblings, 0 replies; 13+ messages in thread
From: Ferruh Yigit @ 2017-01-11 17:36 UTC (permalink / raw)
  To: Stephen Hemminger, dev

On 1/9/2017 11:30 PM, Stephen Hemminger wrote:
> A return statement at end of void function is unnecessary.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_82575.c   |  4 ----
>  lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_i210.c    |  2 --
>  lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mac.c     |  4 ----
>  lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_phy.c     |  1 -
>  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c   |  3 +--
>  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c      |  2 --
>  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c      | 11 ++---------
>  lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c |  2 --
>  8 files changed, 3 insertions(+), 26 deletions(-)
> 

I am not sure about benefit of refactoring drivers in KNI, since we have
no intention to do development on that code, at best we can get updated
version of the driver and replace, which I don't expect to happen soon.

But if you have strong opinion on this:
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] ixgbe: remove useless return
  2017-01-09 23:30 ` [PATCH 6/7] ixgbe: " Stephen Hemminger
@ 2017-02-01 16:40   ` Ananyev, Konstantin
  2017-02-08 14:43     ` Dai, Wei
  0 siblings, 1 reply; 13+ messages in thread
From: Ananyev, Konstantin @ 2017-02-01 16:40 UTC (permalink / raw)
  To: Stephen Hemminger, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Monday, January 9, 2017 11:30 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH 6/7] ixgbe: remove useless return
> 
> If all goto's lead to a return, then better to get rid of goto.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/ixgbe/ixgbe_82599_bypass.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_82599_bypass.c b/drivers/net/ixgbe/ixgbe_82599_bypass.c
> index de9fa5a7..af55cc0a 100644
> --- a/drivers/net/ixgbe/ixgbe_82599_bypass.c
> +++ b/drivers/net/ixgbe/ixgbe_82599_bypass.c
> @@ -73,7 +73,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
>  					   &eeprom_data);
>  	if (status) {
>  		PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS0");
> -		goto out;
> +		return;
>  	}
> 
>  	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
> @@ -83,7 +83,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
>  					    eeprom_data);
>  	if (status) {
>  		PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS0");
> -		goto out;
> +		return;
>  	}
> 
>  	/* Set RS1 */
> @@ -92,7 +92,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
>  					   &eeprom_data);
>  	if (status) {
>  		PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS1");
> -		goto out;
> +		return;
>  	}
> 
>  	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
> @@ -102,10 +102,8 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
>  					    eeprom_data);
>  	if (status) {
>  		PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS1");
> -		goto out;
> +		return;
>  	}
> -out:
> -	return;
>  }
> 
>  /**
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.11.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/7] ethdev: reduce goto's in attach/detach
  2017-01-10  8:40   ` Thomas Monjalon
@ 2017-02-01 17:26     ` Ferruh Yigit
  0 siblings, 0 replies; 13+ messages in thread
From: Ferruh Yigit @ 2017-02-01 17:26 UTC (permalink / raw)
  To: Thomas Monjalon, Stephen Hemminger; +Cc: dev

On 1/10/2017 8:40 AM, Thomas Monjalon wrote:
> Hi Stephen,
> 
> Please use --in-reply-to to keep v1 and v2 in the same thread.
> 
> Comment below
> 
> 
> 2017-01-09 15:30, Stephen Hemminger:
>>  int
>>  rte_eth_dev_detach(uint8_t port_id, char *name)
>>  {
>> -	int ret = -1;
>> +	int ret;
>>  
>> -	if (name == NULL) {
>> -		ret = -EINVAL;
>> -		goto err;
>> -	}
>> +	if (name == NULL)
>> +		return -EINVAL;
>>  
>>  	/* FIXME: move this to eal, once device flags are relocated there */
>> -	if (rte_eth_dev_is_detachable(port_id))
>> -		goto err;
>> +	ret = rte_eth_dev_is_detachable(port_id);
>> +	if (ret < 0)
>> +		return ret;
> 
> As commented on v1 by Ferruh and I, you should check also positive value.

In case it is not obvious, this patchset is stuck because of above
change request not addressed.

> 
>>  
>>  	snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
>>  		 "%s", rte_eth_devices[port_id].data->name);
>> -	ret = rte_eal_dev_detach(name);
>> -	if (ret < 0)
>> -		goto err;
>>  
>> -	return 0;
>> -
>> -err:
>> -	return ret;
>> +	return rte_eal_dev_detach(name);
>>  }
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] ixgbe: remove useless return
  2017-02-01 16:40   ` Ananyev, Konstantin
@ 2017-02-08 14:43     ` Dai, Wei
  0 siblings, 0 replies; 13+ messages in thread
From: Dai, Wei @ 2017-02-08 14:43 UTC (permalink / raw)
  To: Ananyev, Konstantin, Stephen Hemminger, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ananyev, Konstantin
> Sent: Thursday, February 2, 2017 12:41 AM
> To: Stephen Hemminger <stephen@networkplumber.org>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 6/7] ixgbe: remove useless return
Subject line had better be net/ixgbe: remove useless return
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> > Sent: Monday, January 9, 2017 11:30 PM
> > To: dev@dpdk.org
> > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH 6/7] ixgbe: remove useless return
> >
> > If all goto's lead to a return, then better to get rid of goto.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  drivers/net/ixgbe/ixgbe_82599_bypass.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_82599_bypass.c
> > b/drivers/net/ixgbe/ixgbe_82599_bypass.c
> > index de9fa5a7..af55cc0a 100644
> > --- a/drivers/net/ixgbe/ixgbe_82599_bypass.c
> > +++ b/drivers/net/ixgbe/ixgbe_82599_bypass.c
> > @@ -73,7 +73,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw,
> ixgbe_link_speed speed)
> >  					   &eeprom_data);
> >  	if (status) {
> >  		PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS0");
> > -		goto out;
> > +		return;
> >  	}
> >
> >  	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) &
> rs;
> > @@ -83,7 +83,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw,
> ixgbe_link_speed speed)
> >  					    eeprom_data);
> >  	if (status) {
> >  		PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS0");
> > -		goto out;
> > +		return;
> >  	}
> >
> >  	/* Set RS1 */
> > @@ -92,7 +92,7 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw,
> ixgbe_link_speed speed)
> >  					   &eeprom_data);
> >  	if (status) {
> >  		PMD_DRV_LOG(ERR, "Failed to read Rx Rate Select RS1");
> > -		goto out;
> > +		return;
> >  	}
> >
> >  	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) &
> rs;
> > @@ -102,10 +102,8 @@ ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw,
> ixgbe_link_speed speed)
> >  					    eeprom_data);
> >  	if (status) {
> >  		PMD_DRV_LOG(ERR, "Failed to write Rx Rate Select RS1");
> > -		goto out;
> > +		return;
This return is also not needed. :-)
> >  	}
> > -out:
> > -	return;
> >  }
> >
> >  /**
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
> 
> > 2.11.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-02-08 14:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 23:30 [PATCH v2 0/7] minor cleanup Stephen Hemminger
2017-01-09 23:30 ` [PATCH 1/7] bonding, malloc, bitmap: remove useless return Stephen Hemminger
2017-01-09 23:30 ` [PATCH 2/7] ethdev: reduce goto's in attach/detach Stephen Hemminger
2017-01-10  8:40   ` Thomas Monjalon
2017-02-01 17:26     ` Ferruh Yigit
2017-01-09 23:30 ` [PATCH 3/7] bnx2x: remove useless return's Stephen Hemminger
2017-01-09 23:30 ` [PATCH 4/7] kni: remove useless return statements Stephen Hemminger
2017-01-11 17:36   ` Ferruh Yigit
2017-01-09 23:30 ` [PATCH 5/7] i40e: remove useless return Stephen Hemminger
2017-01-09 23:30 ` [PATCH 6/7] ixgbe: " Stephen Hemminger
2017-02-01 16:40   ` Ananyev, Konstantin
2017-02-08 14:43     ` Dai, Wei
2017-01-09 23:30 ` [PATCH 7/7] igb: remove useless return's Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.