metrics: fix compilation with -Og
authorOlivier Matz <olivier.matz@6wind.com>
Mon, 11 Sep 2017 15:13:30 +0000 (17:13 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:50 +0000 (02:49 +0200)
commit0e985314d5f8efac3725e8bd703278713f542bbe
treec5e9f4642566aa34bcec966593e942a87304dbf5
parent1123f16eb37b19dcabe2b2313f99911c59df91f3
metrics: fix compilation with -Og

The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the following
error:

  CC rte_metrics.o
  rte_metrics.c: In function
  ‘rte_metrics_reg_names’: rte_metrics.c:153:22: error: ‘entry’
                           may be used uninitialized in this function
                           [-Werror=maybe-uninitialized]
    entry->idx_next_set = 0;
    ~~~~~~~~~~~~~~~~~~~~^~~

This is a false positive, gcc is not able to see that we always go in
the loop at least once, initializing entry.

Fix the warning by initializing entry to NULL.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_metrics/rte_metrics.c