From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D2F0A04F7; Tue, 7 Jan 2020 04:26:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DF3CF1D8F9; Tue, 7 Jan 2020 04:26:57 +0100 (CET) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 7B9DB1D8DA; Tue, 7 Jan 2020 04:26:55 +0100 (CET) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0C76DCAD5DDBDB444DC1; Tue, 7 Jan 2020 11:26:54 +0800 (CST) Received: from localhost (10.133.209.164) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Tue, 7 Jan 2020 11:26:44 +0800 From: Yunjian Wang To: , , , CC: , Yunjian Wang , Date: Tue, 7 Jan 2020 11:25:48 +0800 Message-ID: <1578367548-15596-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.209.164] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3] net/vhost: fix return value of vhost creates not checked X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The function eth_dev_vhost_create() could return errors, the return value need to be checked. Fixes: ee584e9710b9 ("vhost: add driver on top of the library") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- v3: * Add newline at the end of the error message v2: * Change function eth_dev_vhost_create return 0 on success --- drivers/net/vhost/rte_eth_vhost.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 46f01a7..a635889 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1302,7 +1302,7 @@ struct vhost_xstats_name_off { } rte_eth_dev_probing_finish(eth_dev); - return data->port_id; + return 0; error: if (internal) { @@ -1455,8 +1455,10 @@ struct vhost_xstats_name_off { if (dev->device.numa_node == SOCKET_ID_ANY) dev->device.numa_node = rte_socket_id(); - eth_dev_vhost_create(dev, iface_name, queues, dev->device.numa_node, - flags, disable_flags); + ret = eth_dev_vhost_create(dev, iface_name, queues, + dev->device.numa_node, flags, disable_flags); + if (ret == -1) + VHOST_LOG(ERR, "Failed to create %s\n", name); out_free: rte_kvargs_free(kvlist); -- 1.8.3.1