examples/l2fwd-event: fix return value handling from API
diff mbox series

Message ID 20200130081912.18642-1-skori@marvell.com
State Accepted, archived
Delegated to: Jerin Jacob
Headers show
Series
  • examples/l2fwd-event: fix return value handling from API
Related show

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Sunil Kumar Kori Jan. 30, 2020, 8:19 a.m. UTC
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 <skori@marvell.com>
---
 examples/l2fwd-event/l2fwd_event_generic.c       |  9 +++++++--
 examples/l2fwd-event/l2fwd_event_internal_port.c | 10 ++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

Comments

Pavan Nikhilesh Bhagavatula Feb. 3, 2020, 5:14 a.m. UTC | #1
>Subject: [PATCH] examples/l2fwd-event: fix return value handling from
>API
>
>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 <skori@marvell.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

>---
> 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;
>--
>2.17.1
Jerin Jacob Feb. 15, 2020, 7:06 a.m. UTC | #2
On Mon, Feb 3, 2020 at 10:44 AM Pavan Nikhilesh Bhagavatula
<pbhagavatula@marvell.com> wrote:
>
> >Subject: [PATCH] examples/l2fwd-event: fix return value handling from
> >API
> >
> >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")
Cc: stable@dpdk.org

> >Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>
> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
Applied to dpdk-next-eventdev/master. Thanks.

Patch
diff mbox series

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;