net/bonding: fix error code when creating bonded device

Message ID 1594714783-23996-1-git-send-email-xavier.huwei@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/bonding: fix error code when creating bonded device |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS

Commit Message

Wei Hu (Xavier) July 14, 2020, 8:19 a.m. UTC
  Because the return value of rte_vdev_init() has multiple non-zero values,
when rte_vdev_init() return non-zero in the rte_eth_bond_create() function,
it should return the actual error code rather than -ENOMEM.

Fixes: 68451eb6698c ("net/bonding: call through EAL on create/free")
Cc: stable@dpdk.org

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/bonding/rte_eth_bond_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit July 14, 2020, 11:58 a.m. UTC | #1
On 7/14/2020 9:19 AM, Wei Hu (Xavier) wrote:
> Because the return value of rte_vdev_init() has multiple non-zero values,
> when rte_vdev_init() return non-zero in the rte_eth_bond_create() function,
> it should return the actual error code rather than -ENOMEM.
> 
> Fixes: 68451eb6698c ("net/bonding: call through EAL on create/free")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index f38eb3b..d77dc40 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -167,7 +167,7 @@  rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 
 	ret = rte_vdev_init(name, devargs);
 	if (ret)
-		return -ENOMEM;
+		return ret;
 
 	ret = rte_eth_dev_get_port_by_name(name, &port_id);
 	RTE_ASSERT(!ret);