net/cxgbe: fix warnings when using optimization=1 flag

Message ID 155c777425bc32c4d287373cd711825f8de9bcf2.1654764457.git.rahul.lakkireddy@chelsio.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/cxgbe: fix warnings when using optimization=1 flag |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Rahul Lakkireddy June 9, 2022, 8:49 a.m. UTC
  Initialize maddr and mtype to fix following warnings when
using optimization=1 compilation flag.

In file included from ../drivers/net/cxgbe/base/common.h:13,
                 from ../drivers/net/cxgbe/cxgbe_main.c:37:
../drivers/net/cxgbe/cxgbe_main.c: In function ‘cxgbe_probe’:
../drivers/net/cxgbe/base/t4fw_interface.h:656:7: warning: ‘maddr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ((x) << S_FW_CAPS_CONFIG_CMD_MEMADDR64K_CF)
       ^~
../drivers/net/cxgbe/cxgbe_main.c:1111:40: note: ‘maddr’ was declared here
  u32 finiver, finicsum, cfcsum, mtype, maddr, param, val;
                                        ^~~~~
In file included from ../drivers/net/cxgbe/base/common.h:13,
                 from ../drivers/net/cxgbe/cxgbe_main.c:37:
../drivers/net/cxgbe/base/t4fw_interface.h:648:7: warning: ‘mtype’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ((x) << S_FW_CAPS_CONFIG_CMD_MEMTYPE_CF)
       ^~
../drivers/net/cxgbe/cxgbe_main.c:1111:33: note: ‘mtype’ was declared here
  u32 finiver, finicsum, cfcsum, mtype, maddr, param, val;
                                 ^~~~~
Bugzilla ID: 1029
Fixes: 6d7d651bbc15 ("net/cxgbe: read firmware configuration file from filesystem")

Reported-by: Daxue Gao <daxuex.gao@intel.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/cxgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit June 9, 2022, 2:02 p.m. UTC | #1
On 6/9/2022 9:49 AM, Rahul Lakkireddy wrote:
> Initialize maddr and mtype to fix following warnings when
> using optimization=1 compilation flag.
> 
> In file included from ../drivers/net/cxgbe/base/common.h:13,
>                   from ../drivers/net/cxgbe/cxgbe_main.c:37:
> ../drivers/net/cxgbe/cxgbe_main.c: In function ‘cxgbe_probe’:
> ../drivers/net/cxgbe/base/t4fw_interface.h:656:7: warning: ‘maddr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    ((x) << S_FW_CAPS_CONFIG_CMD_MEMADDR64K_CF)
>         ^~
> ../drivers/net/cxgbe/cxgbe_main.c:1111:40: note: ‘maddr’ was declared here
>    u32 finiver, finicsum, cfcsum, mtype, maddr, param, val;
>                                          ^~~~~
> In file included from ../drivers/net/cxgbe/base/common.h:13,
>                   from ../drivers/net/cxgbe/cxgbe_main.c:37:
> ../drivers/net/cxgbe/base/t4fw_interface.h:648:7: warning: ‘mtype’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    ((x) << S_FW_CAPS_CONFIG_CMD_MEMTYPE_CF)
>         ^~
> ../drivers/net/cxgbe/cxgbe_main.c:1111:33: note: ‘mtype’ was declared here
>    u32 finiver, finicsum, cfcsum, mtype, maddr, param, val;
>                                   ^~~~~
> Bugzilla ID: 1029
> Fixes: 6d7d651bbc15 ("net/cxgbe: read firmware configuration file from filesystem")
> 
> Reported-by: Daxue Gao<daxuex.gao@intel.com>
> Signed-off-by: Rahul Lakkireddy<rahul.lakkireddy@chelsio.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 7b162af3e7..3c02c98b3d 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1108,9 +1108,10 @@  static int cxgbe_load_fw_config_from_filesystem(struct adapter *adap,
 
 static int cxgbe_load_fw_config(struct adapter *adap)
 {
-	u32 finiver, finicsum, cfcsum, mtype, maddr, param, val;
 	struct fw_caps_config_cmd caps_cmd = { 0 };
+	u32 finiver, finicsum, cfcsum, param, val;
 	const char *config_name = NULL;
+	u32 mtype = 0, maddr = 0;
 	int ret;
 
 	ret = cxgbe_load_fw_config_from_filesystem(adap, &config_name,