From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=JTzqkNpATfT869uaQUZHXOZhy067/+mXkaflbAIL3PU=; b=H0q4jgAY9Dws33Ua8gKx8mYuTDUqbrbg1RBfwANdR3DWXQGHZW1dVZIw03Z3HhRItT DzZiJIHAR90hqThDXqrK01bGEmF44FXTHpjPEsfuUoLfAupZFUnDek2He8Y0imLr7OQw Rg6LBI47CJ9nrlHUEnMjhizS02ZzDGR1lZBkAUK/SAPA83YViZNtgY+8ip6luhnUAFqU flQnpJ9CfHD0vvDuSjbe3/xLNc+es7cVtc71shydo1QiLo+MG0WQBxjByoO9neHW+ddF Qys3lwXd/CI1awiZqV6TdvWgZwSeZoGlhjUu3goASWaYkzFK+YBlj6VIm/6yKMPqeczH AxLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=JTzqkNpATfT869uaQUZHXOZhy067/+mXkaflbAIL3PU=; b=YMSYjAf2TmYD4MdfvcjfAchnGF1R/oxcScC+s8ZLZAEqKsEr25/pqzeri3OK1yXwll kO9D/VS7ve9TB4k4RNbb/RCrTTMenCSKLmibcVGWyWSNIqQVPIVqDQJb3RRTL9jCySbh KPx33P38hIaTSWzLtBQ0fiojzKY0nh6UFhczXD62cAHbwj9SqVcpZPISuTvATFnBT2FP L1rvjSBYwNgIdV1ZxagyuEgM9TQu5EsfxE5FhRqqG3Sd0QgsHlKJkUBtaB8jNy0j+pV+ nLK2DcdYf1Tz2+u79hl7n5ZHOnRhDYz2yvIGMwcAkz5yAttc8JDtcvmiq2s5TAoEBEFO pY/g== X-Gm-Message-State: AIkVDXJWEMo+z42jySlE2aWJ/oHHKdgIaNaW7Kfl9j78jIj3FPaB1Gqpo+poP8Bdl5rVB+pG X-Received: by 10.28.174.76 with SMTP id x73mr11137349wme.25.1482402821720; Thu, 22 Dec 2016 02:33:41 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id d10sm34858091wja.20.2016.12.22.02.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 02:33:41 -0800 (PST) From: Thomas Monjalon To: Stephen Hemminger Cc: dev@dpdk.org, Ferruh Yigit Date: Thu, 22 Dec 2016 11:33:40 +0100 Message-ID: <8501741.XOemNz1Od4@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <4179dac2-f433-ca40-2f4f-235abab77c6c@intel.com> 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-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [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, 22 Dec 2016 10:33:42 -0000 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;