[PATCH v4 4/9] app/test: avoid duplicate initialization
Stephen Hemminger
stephen at networkplumber.org
Thu Nov 21 19:23:25 CET 2024
The event_dev_config initialization had duplicate assignments
to the same element. Change to use structure initialization
so that compiler will catch this type of bug.
Link: https://pvs-studio.com/en/blog/posts/cpp/1179/
Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")
Cc: jerin.jacob at caviumnetworks.com
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar at intel.com>
---
app/test/test_event_crypto_adapter.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 9d38a66bfa..ab24e30a97 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -1154,21 +1154,17 @@ configure_cryptodev(void)
static inline void
evdev_set_conf_values(struct rte_event_dev_config *dev_conf,
- struct rte_event_dev_info *info)
+ const struct rte_event_dev_info *info)
{
- memset(dev_conf, 0, sizeof(struct rte_event_dev_config));
- dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns;
- dev_conf->nb_event_ports = NB_TEST_PORTS;
- dev_conf->nb_event_queues = NB_TEST_QUEUES;
- dev_conf->nb_event_queue_flows = info->max_event_queue_flows;
- dev_conf->nb_event_port_dequeue_depth =
- info->max_event_port_dequeue_depth;
- dev_conf->nb_event_port_enqueue_depth =
- info->max_event_port_enqueue_depth;
- dev_conf->nb_event_port_enqueue_depth =
- info->max_event_port_enqueue_depth;
- dev_conf->nb_events_limit =
- info->max_num_events;
+ *dev_conf = (struct rte_event_dev_config) {
+ .dequeue_timeout_ns = info->min_dequeue_timeout_ns,
+ .nb_event_ports = NB_TEST_PORTS,
+ .nb_event_queues = NB_TEST_QUEUES,
+ .nb_event_queue_flows = info->max_event_queue_flows,
+ .nb_event_port_dequeue_depth = info->max_event_port_dequeue_depth,
+ .nb_event_port_enqueue_depth = info->max_event_port_enqueue_depth,
+ .nb_events_limit = info->max_num_events,
+ };
}
static int
--
2.45.2
More information about the dev
mailing list