net/kni: check init result

This patch adds checking for rte_kni_init() result.

Fixes: 75e2bc54c0 ("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>
This commit is contained in:
Chengwen Feng 2021-04-21 10:14:18 +08:00 committed by Ferruh Yigit
parent 8202309f9f
commit 7fa949fd11

View 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++;