From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Date: Wed, 7 Dec 2016 17:47:50 -0800 Message-ID: <20161208014751.24285-2-stephen@networkplumber.org> References: <20161208014751.24285-1-stephen@networkplumber.org> Cc: Stephen Hemminger To: dev@dpdk.org Return-path: Received: from mail-pg0-f41.google.com (mail-pg0-f41.google.com [74.125.83.41]) by dpdk.org (Postfix) with ESMTP id A6FE72A66 for ; Thu, 8 Dec 2016 02:48:00 +0100 (CET) Received: by mail-pg0-f41.google.com with SMTP id 3so168157014pgd.0 for ; Wed, 07 Dec 2016 17:48:00 -0800 (PST) In-Reply-To: <20161208014751.24285-1-stephen@networkplumber.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Extra goto's to just a return are unnecessary. Signed-off-by: Stephen Hemminger --- 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