Skip to content

Commit

Permalink
test/event: avoid duplicate initialization
Browse files Browse the repository at this point in the history
[ upstream commit 8c08b10d047ac64fb98709871b192698663af7d7 ]

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: f8f9d23 ("test/eventdev: add unit tests")

Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
Acked-by: Abhinandan Gujjar <[email protected]>
  • Loading branch information
shemminger authored and kevintraynor committed Nov 27, 2024
1 parent 19e497e commit ce0f3e1
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions app/test/test_event_crypto_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,21 +589,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
Expand Down

0 comments on commit ce0f3e1

Please sign in to comment.