net/kni: check init result
authorChengwen Feng <fengchengwen@huawei.com>
Wed, 21 Apr 2021 02:14:18 +0000 (10:14 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 26 Apr 2021 10:17:39 +0000 (12:17 +0200)
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 <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/kni/rte_eth_kni.c

index 9ce74e5..4d2a42d 100644 (file)
@@ -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++;