From: Conor Walsh Date: Tue, 10 Nov 2020 11:03:13 +0000 (+0000) Subject: test/ring: fix build for O1 optimization X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=262cf9152b54b35e86ea474833828073a6d9b728;p=dpdk.git 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 --- 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);