raw/ifpga: fix build with optimization

Compile failed with cflag optimization=1 on Ubuntu20.04 with GCC10.3,
it reported vendor_id and dev_id may be used uninitialized in function
ifpga_rawdev_fill_info().
Actually it's not the truth, the variables are initialized in function
ifpga_get_dev_vendor_id(). To avoid such compile error, the variables
are initialized when they are defined.

Fixes: 9c006c45d0 ("raw/ifpga: scan PCIe BDF device tree")
Cc: stable@dpdk.org

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
This commit is contained in:
Wei Huang 2022-03-16 03:26:30 -04:00 committed by Thomas Monjalon
parent 4ac7359b5c
commit 047c25401d

View File

@ -225,7 +225,8 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev)
unsigned int dom, bus, dev;
int func;
uint32_t dev_id, vendor_id;
uint32_t dev_id = 0;
uint32_t vendor_id = 0;
adapter = ifpga_dev ? ifpga_rawdev_get_priv(ifpga_dev->rawdev) : NULL;
if (!adapter)