From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 01 Feb 2017 09:26:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,320,1477983600"; d="scan'208";a="38354302" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.38]) ([10.237.220.38]) by orsmga002.jf.intel.com with ESMTP; 01 Feb 2017 09:26:51 -0800 To: Thomas Monjalon , Stephen Hemminger References: <20170109233022.31154-1-stephen@networkplumber.org> <20170109233022.31154-3-stephen@networkplumber.org> <29688688.OdmTMFx9gs@xps13> Cc: dev@dpdk.org From: Ferruh Yigit Message-ID: Date: Wed, 1 Feb 2017 17:26:49 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <29688688.OdmTMFx9gs@xps13> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 2/7] ethdev: reduce goto's in attach/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: Wed, 01 Feb 2017 17:26:53 -0000 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); >> } >