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

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

  CC eal_pci_uio.o
  eal_pci_uio.c: In function ‘pci_get_uio_de ’:
  eal_pci_uio.c:221:9: error: ‘uio_num’ may be used uninitialized in
                       this function [-Werror=maybe-uninitialized]
  return uio_num;
         ^~~~~~~

This is a false positive: gcc is not able to see that when e != NULL,
uio_num is always set. Fix the warning by initializing uio_num to -1,
and by the way, change the type to int.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_eal/linuxapp/eal/eal_pci_uio.c