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 <alialnu@nvidia.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
  • Loading branch information
kevintraynor committed Sep 13, 2024
1 parent 6808180 commit a472cf9
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 = {};
uint64_t s_mask = 0;

mtr_stats_convert(p,
Expand Down

0 comments on commit a472cf9

Please sign in to comment.