From patchwork Wed Apr 21 02:14:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 91894 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C92B1A0547; Wed, 21 Apr 2021 04:14:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B89741385; Wed, 21 Apr 2021 04:14:13 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 58EF340A4B for ; Wed, 21 Apr 2021 04:14:11 +0200 (CEST) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FQ3vk4Ncxz1BH22 for ; Wed, 21 Apr 2021 10:11:46 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Wed, 21 Apr 2021 10:14:06 +0800 From: "Min Hu (Connor)" To: CC: Date: Wed, 21 Apr 2021 10:14:18 +0800 Message-ID: <1618971258-58915-1-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] net/kni: check rte kni init result X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng 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 9ce74e5..4d2a42d 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++;