From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH 2/7] ethdev: reduce goto's in attach/detach Date: Wed, 1 Feb 2017 17:26:49 +0000 Message-ID: References: <20170109233022.31154-1-stephen@networkplumber.org> <20170109233022.31154-3-stephen@networkplumber.org> <29688688.OdmTMFx9gs@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Thomas Monjalon , Stephen Hemminger Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3E87B2C39 for ; Wed, 1 Feb 2017 18:26:53 +0100 (CET) In-Reply-To: <29688688.OdmTMFx9gs@xps13> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 1/10/2017 8:40 AM, Thomas Monjalon wrote: > Hi Stephen, > > Please use --in-reply-to to keep v1 and v2 in the same thread. > > Comment below > > > 2017-01-09 15:30, Stephen Hemminger: >> 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; > > As commented on v1 by Ferruh and I, you should check also positive value. In case it is not obvious, this patchset is stuck because of above change request not addressed. > >> >> 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); >> } >