From 7fa949fd1122b2e529c538489e2287736f1540e3 Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Wed, 21 Apr 2021 10:14:18 +0800 Subject: [PATCH] net/kni: check init result This patch adds checking for rte_kni_init() result. Fixes: 75e2bc54c018 ("net/kni: add KNI PMD") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) Acked-by: Ferruh Yigit --- drivers/net/kni/rte_eth_kni.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 9ce74e549b..4d2a42ddab 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -406,8 +406,13 @@ eth_kni_create(struct rte_vdev_device *vdev, static int kni_init(void) { - if (is_kni_initialized == 0) - rte_kni_init(MAX_KNI_PORTS); + int ret; + + if (is_kni_initialized == 0) { + ret = rte_kni_init(MAX_KNI_PORTS); + if (ret < 0) + return ret; + } is_kni_initialized++; -- 2.20.1