From 262cf9152b54b35e86ea474833828073a6d9b728 Mon Sep 17 00:00:00 2001 From: Conor Walsh Date: Tue, 10 Nov 2020 11:03:13 +0000 Subject: [PATCH] test/ring: fix build for O1 optimization When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc sees zcd in test_ring.h as possibly being uninitialised. To correct this error if statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were corrected within test_ring_mt_peek_stress_zc.c Fixes: f72299fd157d ("test/ring: add stress tests for zero copy API") Signed-off-by: Conor Walsh Reviewed-by: Honnappa Nagarahalli --- app/test/test_ring_mt_peek_stress_zc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/test/test_ring_mt_peek_stress_zc.c b/app/test/test_ring_mt_peek_stress_zc.c index 7e0bd511a7..85f0262ba0 100644 --- a/app/test/test_ring_mt_peek_stress_zc.c +++ b/app/test/test_ring_mt_peek_stress_zc.c @@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n, struct rte_ring_zc_data zcd; m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail); - n = (m == n) ? n : 0; - if (n != 0) { + if (m != 0) { /* Copy the data from the ring */ test_ring_copy_from(&zcd, obj, -1, n); rte_ring_dequeue_zc_finish(r, n); @@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n, struct rte_ring_zc_data zcd; m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free); - n = (m == n) ? n : 0; - if (n != 0) { + if (m != 0) { /* Copy the data from the ring */ test_ring_copy_to(&zcd, obj, -1, n); rte_ring_enqueue_zc_finish(r, n); -- 2.20.1