[dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach
Stephen Hemminger
stephen at networkplumber.org
Thu Dec 8 02:47:50 CET 2016
Extra goto's to just a return are unnecessary.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/librte_ether/rte_ethdev.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4209ad0..40c7cc6 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -466,27 +466,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.10.2
More information about the dev
mailing list