From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Date: Thu, 22 Dec 2016 11:33:40 +0100 Message-ID: <8501741.XOemNz1Od4@xps13> References: <20161208014751.24285-1-stephen@networkplumber.org> <20161208014751.24285-2-stephen@networkplumber.org> <4179dac2-f433-ca40-2f4f-235abab77c6c@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Ferruh Yigit To: Stephen Hemminger Return-path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 2FCF710D09 for ; Thu, 22 Dec 2016 11:33:42 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id g23so171847738wme.1 for ; Thu, 22 Dec 2016 02:33:42 -0800 (PST) In-Reply-To: <4179dac2-f433-ca40-2f4f-235abab77c6c@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-12-08 10:25, Ferruh Yigit: > On 12/8/2016 1:47 AM, Stephen Hemminger wrote: > > --- 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) > > rte_eth_dev_is_detachable() can return 1 to indicate device is not > detachable. > > > + return ret; It should be ret = rte_eth_dev_is_detachable(port_id); if (ret) return -1;