eventdev: fix build with icc
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Tue, 17 Apr 2018 13:13:42 +0000 (14:13 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 19 Apr 2018 11:42:59 +0000 (13:42 +0200)
ICC complains about variable being used before its value is set.
Since the variable is only assigned in the for loop,
its declaration is moved inside and is initialized.

lib/librte_eventdev/rte_event_timer_adapter.c(708): error #592:
variable "ret" is used before its value is set
        RTE_SET_USED(ret);

Fixes: 6750b21bd6af ("eventdev: add default software timer adapter")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
lib/librte_eventdev/rte_event_timer_adapter.c

index 6eba6b4..9a863f5 100644 (file)
@@ -695,7 +695,7 @@ check_destination_event_queue(struct rte_event_timer *evtim,
 static int
 sw_event_timer_adapter_service_func(void *arg)
 {
-       int ret, i, num_msgs;
+       int i, num_msgs;
        uint64_t cycles, opaque;
        uint16_t nb_evs_flushed = 0;
        uint16_t nb_evs_invalid = 0;
@@ -705,8 +705,6 @@ sw_event_timer_adapter_service_func(void *arg)
        struct rte_timer *tim = NULL;
        struct msg *msg, *msgs[NB_OBJS];
 
-       RTE_SET_USED(ret);
-
        adapter = arg;
        sw_data = adapter->data->adapter_priv;
 
@@ -720,6 +718,10 @@ sw_event_timer_adapter_service_func(void *arg)
                                                  (void **)msgs, NB_OBJS, NULL);
 
                for (i = 0; i < num_msgs; i++) {
+                       int ret = 0;
+
+                       RTE_SET_USED(ret);
+
                        msg = msgs[i];
                        evtim = msg->evtim;