]> git.droids-corp.org - dpdk.git/commitdiff
examples/l2fwd-event: fix error checking
authorSunil Kumar Kori <skori@marvell.com>
Thu, 30 Jan 2020 08:19:12 +0000 (13:49 +0530)
committerJerin Jacob <jerinj@marvell.com>
Sat, 15 Feb 2020 07:04:46 +0000 (08:04 +0100)
Patch fixes coverity issues which handle return values from API
calling.

Coverity issue: 350588, 350594, 350598, 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>
examples/l2fwd-event/l2fwd_event_generic.c
examples/l2fwd-event/l2fwd_event_internal_port.c

index b07306a17b05fe65c90f6b6afefbfa4152e392ab..2dc95e5f7d1a7272059dd209fed6dd0d6df924fe 100644 (file)
@@ -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;
 
index 5e6e8598af58af73738697c333a32ca38c7b4af4..63d57b46c2dab3409018f802e41931a39c8deaf1 100644 (file)
@@ -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;