From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=acAk+PeW2KXY+wfLOl96Ujjzs0BV9oBZJVbLRHxlOIE=; b=zLtGwZQc6ivnt87BEo1kLhVIin05PLuT9qc/HxdemD2sBYSRBHTettE+4nS5X3EjfV 1+TwHYcnGpABg+5fS/+n/QeZsIPiQqrDMi0PEayefrro3YO5ZRdkioefRJp92BRU50T1 C/iPb+8j4FtBFiemHWLi82VYWhUHj8Srk561Su3YLPGR3WclLXeXtxrw10tY5tk69hzG 3ShOCXswgm6avrh3jok2zQXF+POeG7bPM0Fm/KNNd1KQexSE4r6WlswLIz0G2hLt6DlW dRBYjEOZJCPhPD6HOJ/p2CuaHxbwvCGUdKdwvU51AcEPv6Q8GKz2thWFGRHiEVLr8Pp1 5Irg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=acAk+PeW2KXY+wfLOl96Ujjzs0BV9oBZJVbLRHxlOIE=; b=KElEugkzRHw4ncV5N+psDk1aveQEg1H5YmIvvC0K02ylt7bxdrsspSpRbqmO1wfULU XTE/GqYeKLQPLHUYHmDWBzCm2ob5J0fa+aSwi13yOj7wlbHFB/i2Vecslmz2c3QA9XRh E9SQEhVNC1AfpP3KwlMj0mnwU3VYc16ehLW61fu2sxwQBXgiySYwu+Bx8jJodXXaiGDb 1cdcxyxNjCIHYWeMYncFnRKrKDl58sy51R1PB9lbH9Ankp21WgHD09lEZAv+qZ769+8u VTQ6j72/1Y4Y73hwb2BYbm3nS5FMAd2/5HRKrqtJOzuMZgkBmnegnKfsvcM2xjqBPcuW IRXw== X-Gm-Message-State: AKaTC01jfJtv/81jjKvbLknBtLkdWg9hYO4ZkLwrkUT/ZPmOWM9QP6/d6336p2HM0cEGYw== X-Received: by 10.99.21.65 with SMTP id 1mr126430963pgv.163.1481161679995; Wed, 07 Dec 2016 17:47:59 -0800 (PST) Received: from xeon-e3.wavecable.com (204-195-18-65.wavecable.com. [204.195.18.65]) by smtp.gmail.com with ESMTPSA id i194sm45439681pgc.46.2016.12.07.17.47.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Dec 2016 17:47:59 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 7 Dec 2016 17:47:50 -0800 Message-Id: <20161208014751.24285-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161208014751.24285-1-stephen@networkplumber.org> References: <20161208014751.24285-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2016 01:48:01 -0000 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