From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id D5AC81B716 for ; Wed, 9 May 2018 17:29:15 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from shahafs@mellanox.com) with ESMTPS (AES256-SHA encrypted); 9 May 2018 18:06:12 +0300 Received: from unicorn01.mtl.labs.mlnx. (unicorn01.mtl.labs.mlnx [10.7.12.62]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w49F4Sra008373; Wed, 9 May 2018 18:04:30 +0300 From: Shahaf Shuler To: bluca@debian.org Cc: stable@dpdk.org, nelio.laranjeiro@6wind.com, adrien.mazarguil@6wind.com, yskoh@mellanox.com Date: Wed, 9 May 2018 18:04:11 +0300 Message-Id: <6b940cc7e450b9364481fffe106bd7ce8abe4ccc.1525878119.git.shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: Subject: [dpdk-stable] [PATCH v2 19/20] net/mlx5: fix probe return value polarity X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 15:29:16 -0000 [ backported from upstream commit 76d97ed96220506b3ebd4b081609031a95b3d04b ] mlx5 prefixed function returns a negative errno value. the error handler on mlx5_pci_probe is doing the same. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") Signed-off-by: Shahaf Shuler Acked-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 8d27c0ceba..b9e9fa9f1c 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -685,8 +685,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, #else WARN("Tunnel offloading disabled due to old OFED/rdma-core version"); #endif - if (mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr)) { - err = errno; + err = mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr); + if (err) { + DEBUG("ibv_query_device_ex() failed"); goto error; } INFO("%u port(s) detected", device_attr.orig_attr.phys_port_cnt); @@ -731,16 +732,22 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, eth_dev->device = &pci_dev->device; eth_dev->dev_ops = &mlx5_dev_sec_ops; err = mlx5_uar_init_secondary(eth_dev); - if (err) + if (err) { + err = rte_errno; goto error; + } /* Receive command fd from primary process */ err = mlx5_socket_connect(eth_dev); - if (err < 0) + if (err < 0) { + err = rte_errno; goto error; + } /* Remap UAR for Tx queues. */ err = mlx5_tx_uar_remap(eth_dev, err); - if (err) + if (err) { + err = rte_errno; goto error; + } /* * Ethdev pointer is still required as input since * the primary device is not accessible from the @@ -802,11 +809,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (err) { ERROR("failed to process device arguments: %s", strerror(err)); + err = rte_errno; goto port_error; } - if (mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex)) { + err = mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex); + if (err) { ERROR("ibv_query_device_ex() failed"); - err = errno; goto port_error; } config.hw_csum = !!(device_attr_ex.device_cap_flags_ex & @@ -876,8 +884,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, rte_eth_copy_pci_info(eth_dev, pci_dev); eth_dev->device->driver = &mlx5_driver.driver; err = mlx5_uar_init_primary(eth_dev); - if (err) + if (err) { + err = rte_errno; goto port_error; + } /* Configure the first MAC address by default. */ if (mlx5_get_mac(eth_dev, &mac.addr_bytes)) { ERROR("cannot get MAC address, is mlx5_en loaded?" @@ -903,8 +913,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, #endif /* Get actual MTU if possible. */ err = mlx5_get_mtu(eth_dev, &priv->mtu); - if (err) + if (err) { + err = rte_errno; goto port_error; + } DEBUG("port %u MTU is %u", priv->port, priv->mtu); /* * Initialize burst functions to prevent crashes before link-up. -- 2.12.0