From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f179.google.com (mail-wj0-f179.google.com [209.85.210.179]) by dpdk.org (Postfix) with ESMTP id 194B420F for ; Tue, 10 Jan 2017 09:40:48 +0100 (CET) Received: by mail-wj0-f179.google.com with SMTP id kq3so32785308wjc.0 for ; Tue, 10 Jan 2017 00:40:48 -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=haARc1t2oC7g4zkf2ZXs2ulB5SPioIcX87RBcpyO6OM=; b=0qJ7OmfqbbTaPGpfmrGcC4EVVLGMbJ8RBRVPySh5cjQqM2y2e+l0jg0lP46tO3iLnl CACAEZRS/MbbE3IZUU9bz2wdWO5JeTMF6I2tBc5xZYKdcdK/vbLXr/uNxusTNFS7fSys OsrJlVmnUZoJkvmMnscvZXA3MygPh2X9MSeCIzchZnLa/fhppE3QGs9Bp0xR6+ZhbnB6 GMh4WFYnIhFOw2V2pONBBQlKAxSYl/HobYNyUrXsWFKgbDYcr8p81GVIygrZYljd9Rd+ MG3ioKmL1+JaBwn5MeO/YsN4iaWBmBGBLigTblQC2NwcAbM/YoHITl7Q6FXP2Ucb72Ci WBUQ== 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=haARc1t2oC7g4zkf2ZXs2ulB5SPioIcX87RBcpyO6OM=; b=SNI0iGsr7v7JB+1SMcgAseFuPPpzzkiBOChzNaar6aho0BACvbqRzH5SpDJzv2wKgz En7+yNiUFAmUYzJFRoQRwILEI7KLG9G3JxSFS09XnF3rNYZFj8e5ysSsjo2Ge0yssX7c spKtXMtDNw3oTx36R0IjCGJk7eIICcC266BbxUXD26BUFyaq/JjRK37x1U1as4PReNRA XWtGiDqnv4VMX1PRJPhwKX4PDRFEA6mpFJCRuXQSSh6xVGqwXrq2JD+F5hM3yutYKqFm VkT57ojT7wGvQW2C63cq76ReW7DSYvAB9CVlKeDYzELijxC8LIsOj1PCwN/kni6W0e15 gTHA== X-Gm-Message-State: AIkVDXKt9UTMqAZXDN9kkF6jUluBI6isIKL4MuqfwLtHpJRarhElfwLduX2SakuBywDl2EI8 X-Received: by 10.194.26.228 with SMTP id o4mr1074242wjg.139.1484037648524; Tue, 10 Jan 2017 00:40:48 -0800 (PST) Received: from xps13.localnet (111.202.154.77.rev.sfr.net. [77.154.202.111]) by smtp.gmail.com with ESMTPSA id kq6sm1982570wjc.7.2017.01.10.00.40.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jan 2017 00:40:48 -0800 (PST) From: Thomas Monjalon To: Stephen Hemminger Cc: dev@dpdk.org Date: Tue, 10 Jan 2017 09:40:46 +0100 Message-ID: <29688688.OdmTMFx9gs@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20170109233022.31154-3-stephen@networkplumber.org> References: <20170109233022.31154-1-stephen@networkplumber.org> <20170109233022.31154-3-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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: Tue, 10 Jan 2017 08:40:49 -0000 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. > > 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); > }