[dpdk-dev] [PATCH 02/11] eth: do simple return

Stephen Hemminger stephen at networkplumber.org
Fri Jul 24 19:06:15 CEST 2015


Found by coccinelle simple_return.cocci
This function can just use direct return.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/librte_ether/rte_ethdev.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f46426e..a96cd4f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -269,17 +269,12 @@ static int
 rte_eth_dev_create_unique_device_name(char *name, size_t size,
 		struct rte_pci_device *pci_dev)
 {
-	int ret;
-
 	if ((name == NULL) || (pci_dev == NULL))
 		return -EINVAL;
 
-	ret = snprintf(name, size, "%d:%d.%d",
+	return snprintf(name, size, "%d:%d.%d",
 			pci_dev->addr.bus, pci_dev->addr.devid,
 			pci_dev->addr.function);
-	if (ret < 0)
-		return ret;
-	return 0;
 }
 
 int
-- 
2.1.4



More information about the dev mailing list