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

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

  CC cmdline_parse.o
  cmdline_parse.c: In function ‘match_inst’:
  cmdline_parse.c:227:5: error: ‘token_p’ may be used uninitialized in
                         this function [-Werror=maybe-uninitialized]
    if (token_p) {
       ^

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

Fix the warning by initializing token_p to NULL.

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