Skip to content

Commit

Permalink
net/softnic: fix maybe-uninitialized warning
Browse files Browse the repository at this point in the history
In pmd_mtr_stats_read() 'struct rte_mtr_stats s' is initialized
during the call to mtr_stats_convert() but on some systems it
is triggering a compiler warning. e.g.

drivers/net/softnic/rte_eth_softnic_meter.c:916:25: error: 's'
   may be used uninitialized [-Werror=maybe-uninitialized]

Initialize the struct in pmd_mtr_stats_read() to avoid warnings.

Reported-by: Ali Alnubani <[email protected]>
Signed-off-by: Kevin Traynor <[email protected]>
  • Loading branch information
kevintraynor committed Sep 11, 2024
1 parent 6808180 commit b5dfcac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/softnic/rte_eth_softnic_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ pmd_mtr_stats_read(struct rte_eth_dev *dev,

/* Stats format conversion. */
if (stats || stats_mask) {
struct rte_mtr_stats s;
struct rte_mtr_stats s = {0};
uint64_t s_mask = 0;

mtr_stats_convert(p,
Expand Down

0 comments on commit b5dfcac

Please sign in to comment.