From patchwork Thu Jan 30 08:19:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 65356 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0FCD9A0524; Thu, 30 Jan 2020 09:19:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7CB91BFE5; Thu, 30 Jan 2020 09:19:26 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 82C3B1BFAF; Thu, 30 Jan 2020 09:19:24 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00U8DxZY017969; Thu, 30 Jan 2020 00:19:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=FJY83hOw6vP3iFTYJkt/KBYPyTqFKaQrt/WpRDMKq+A=; b=lf0OJ2BlqXDUelL6YImXUbA545PCZaE275oRmZS72J1ugGgQ1NYjfd0nDbLprprA5YtE 2S0tIdJaRMs7cyqKAWOVz1MKCg2tqXGs5o5obTC4/bYx73c/pivUmPvkhR4YNxYEmDyK ynF8wFuqn+mqAcqDG+F4bfnzXFcoQPyGlnGOdWI8x3GbCGmNChXOFXtyNs7ouR/28h8x t23tWWPesB9Iub9o/pNOtACRT33C1ETm4SyfPMVou8Wp05q5TN/CXwkSJjm9y4s+p6/w SBSPnbTcY+OTQ0rs5gL8xgyUlT61rqufzICp5oS5cTVJe7bNk8fvf12NIFu0gJEu8Jl+ ew== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2xupkhs35q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 30 Jan 2020 00:19:23 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 30 Jan 2020 00:19:22 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 30 Jan 2020 00:19:22 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id EF4123F703F; Thu, 30 Jan 2020 00:19:18 -0800 (PST) From: Sunil Kumar Kori To: Marko Kovacevic , Ori Kam , Bruce Richardson , Radu Nicolau , Akhil Goyal , Tomasz Kantecki , Sunil Kumar Kori , "Pavan Nikhilesh" CC: , Date: Thu, 30 Jan 2020 13:49:12 +0530 Message-ID: <20200130081912.18642-1-skori@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-30_02:2020-01-28, 2020-01-30 signatures=0 Subject: [dpdk-dev] [PATCH] examples/l2fwd-event: fix return value handling from API 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" Patch fixes coverity issues which handles return values from API calling. Coverity issue: 350588 Coverity issue: 350594 Coverity issue: 350598 Coverity issue: 350599 Fixes: 3b5476db4823 ("examples/l2fwd-event: setup event queue and port") Signed-off-by: Sunil Kumar Kori Acked-by: Pavan Nikhilesh --- examples/l2fwd-event/l2fwd_event_generic.c | 9 +++++++-- examples/l2fwd-event/l2fwd_event_internal_port.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/l2fwd-event/l2fwd_event_generic.c b/examples/l2fwd-event/l2fwd_event_generic.c index b07306a17..2dc95e5f7 100644 --- a/examples/l2fwd-event/l2fwd_event_generic.c +++ b/examples/l2fwd-event/l2fwd_event_generic.c @@ -112,7 +112,9 @@ l2fwd_event_port_setup_generic(struct l2fwd_resources *rsrc) rte_panic("No space is available\n"); memset(&def_p_conf, 0, sizeof(struct rte_event_port_conf)); - rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf); + ret = rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf); + if (ret < 0) + rte_panic("Error to get default configuration of event port\n"); if (def_p_conf.new_event_threshold < event_p_conf.new_event_threshold) event_p_conf.new_event_threshold = @@ -173,7 +175,10 @@ l2fwd_event_queue_setup_generic(struct l2fwd_resources *rsrc, if (!evt_rsrc->evq.event_q_id) rte_panic("Memory allocation failure\n"); - rte_event_queue_default_conf_get(event_d_id, 0, &def_q_conf); + ret = rte_event_queue_default_conf_get(event_d_id, 0, &def_q_conf); + if (ret < 0) + rte_panic("Error to get default config of event queue\n"); + if (def_q_conf.nb_atomic_flows < event_q_conf.nb_atomic_flows) event_q_conf.nb_atomic_flows = def_q_conf.nb_atomic_flows; diff --git a/examples/l2fwd-event/l2fwd_event_internal_port.c b/examples/l2fwd-event/l2fwd_event_internal_port.c index 5e6e8598a..63d57b46c 100644 --- a/examples/l2fwd-event/l2fwd_event_internal_port.c +++ b/examples/l2fwd-event/l2fwd_event_internal_port.c @@ -109,7 +109,10 @@ l2fwd_event_port_setup_internal_port(struct l2fwd_resources *rsrc) if (!evt_rsrc->evp.event_p_id) rte_panic("Failed to allocate memory for Event Ports\n"); - rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf); + ret = rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf); + if (ret < 0) + rte_panic("Error to get default configuration of event port\n"); + if (def_p_conf.new_event_threshold < event_p_conf.new_event_threshold) event_p_conf.new_event_threshold = def_p_conf.new_event_threshold; @@ -161,7 +164,10 @@ l2fwd_event_queue_setup_internal_port(struct l2fwd_resources *rsrc, uint8_t event_q_id = 0; int32_t ret; - rte_event_queue_default_conf_get(event_d_id, event_q_id, &def_q_conf); + ret = rte_event_queue_default_conf_get(event_d_id, event_q_id, + &def_q_conf); + if (ret < 0) + rte_panic("Error to get default config of event queue\n"); if (def_q_conf.nb_atomic_flows < event_q_conf.nb_atomic_flows) event_q_conf.nb_atomic_flows = def_q_conf.nb_atomic_flows;