Skip to content

Commit

Permalink
raw/ifpga: fix build with optimization
Browse files Browse the repository at this point in the history
[ upstream commit 047c254 ]

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: 9c006c4 ("raw/ifpga: scan PCIe BDF device tree")

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>
  • Loading branch information
weihuan2 authored and bluca committed Mar 17, 2022
1 parent c93d120 commit 5cb14d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/raw/ifpga/ifpga_rawdev.c
Expand Up @@ -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)
Expand Down

0 comments on commit 5cb14d7

Please sign in to comment.