This error is seen in build of type "minsize":

drivers/net/mlx5/mlx5_flow_hw.c:13656:38: error:
'age_idx' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we stop the loop
if rte_ring_dequeue_elem() fails, before using age_idx.

The variable is initialized to allow compiling with "minsize" option.

Fixes: 04a4de756e14 ("net/mlx5: support flow age action with HWS")

Signed-off-by: Cheryl Bansal <[email protected]>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 6e6bf07799..6da09bc5eb 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -13648,7 +13648,7 @@ flow_hw_get_q_aged_flows(struct rte_eth_dev *dev, 
uint32_t queue_id,
        if (nb_contexts == 0)
                return rte_ring_count(r);
        while ((uint32_t)nb_flows < nb_contexts) {
-               uint32_t age_idx;
+               uint32_t age_idx = 0;
 
                if (rte_ring_dequeue_elem(r, &age_idx, sizeof(uint32_t)) < 0)
                        break;
-- 
2.43.0

Reply via email to