raw/ifpga: initialize variable to avoid compile error
PATCH 1/1 raw/ifpga: initialize variable to avoid compile error
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.
--- drivers/raw/ifpga/ifpga_rawdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/raw/ifpga/ifpga_rawdev.c +2 -1
@@ -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)
Signature · 1 line
1.8.3.1
Quoted 18 lines
-----Original Message-----
From: Wei Huang <[email protected]>
Sent: 2022年3月16日 15:27
To: [email protected]; [email protected]; Xu, Rosen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Zhang, Tianfei <[email protected]>; Zhang, Qi Z <[email protected]>; Yigit, Ferruh <[email protected]>; Huang, Wei <[email protected]>
Subject: [PATCH v1] raw/ifpga: initialize variable to avoid compile errorCompile failed with cflag optimization=1 on Ubuntu20.04 with GCC10.3, it reported
vendor_idanddev_idmay be used uninitialized in functionifpga_rawdev_fill_info().
Actually it's not the truth, the variables are initialized in functionifpga_get_dev_vendor_id(). To avoid such compile error, the variables are initialized when they are defined.
Quoted 4 lines
Signed-off-by Wei Huang <[email protected]>Acked-by Tianfei Zhang <[email protected]>Acked-by Rosen Xu <[email protected]>---
16/03/2022 10:27, Gao, DaxueX:
Quoted 9 lines
From: Wei Huang <[email protected]>
Quoted 8 lines
Compile failed with cflag optimization=1 on Ubuntu20.04 with GCC10.3, it reported
vendor_idanddev_idmay be used uninitialized in functionifpga_rawdev_fill_info().
Actually it's not the truth, the variables are initialized in functionifpga_get_dev_vendor_id(). To avoid such compile error, the variables are initialized when they are defined.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Wei Huang <[email protected]>Acked-by Tianfei Zhang <[email protected]>Acked-by Rosen Xu <[email protected]>---
Tested-by Daxue Gao <[email protected]>
We need a "Fixes:" line to help backports, please.
Thomas Monjalon
Applied16/03/2022 10:40, Thomas Monjalon:
Quoted 10 lines
16/03/2022 10:27, Gao, DaxueX:
Quoted 9 lines
From: Wei Huang <[email protected]>
Quoted 8 lines
Compile failed with cflag optimization=1 on Ubuntu20.04 with GCC10.3, it reported
vendor_idanddev_idmay be used uninitialized in functionifpga_rawdev_fill_info().
Actually it's not the truth, the variables are initialized in functionifpga_get_dev_vendor_id(). To avoid such compile error, the variables are initialized when they are defined.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Wei Huang <[email protected]>Acked-by Tianfei Zhang <[email protected]>Acked-by Rosen Xu <[email protected]>Tested-by Daxue Gao <[email protected]>We need a "Fixes:" line to help backports, please.
Added this:
Applied in last minute.