patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1] raw/ifpga: initialize variable to avoid compile error
@ 2022-03-16  7:26 Wei Huang
  2022-03-16  9:27 ` Gao, DaxueX
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Huang @ 2022-03-16  7:26 UTC (permalink / raw)
  To: dev, thomas, rosen.xu, nipun.gupta, hemant.agrawal
  Cc: stable, tianfei.zhang, qi.z.zhang, ferruh.yigit, Wei Huang

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.

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>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 26c1366..6d4117c 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -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)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-16 19:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16  7:26 [PATCH v1] raw/ifpga: initialize variable to avoid compile error Wei Huang
2022-03-16  9:27 ` Gao, DaxueX
2022-03-16  9:40   ` Thomas Monjalon
2022-03-16 19:34     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).