]> git.baikalelectronics.ru Git - kernel.git/commit
ibmvnic: Fix possibly uninitialized old_num_tx_queues variable warning.
authorMichal Suchanek <msuchanek@suse.de>
Tue, 2 Mar 2021 19:47:47 +0000 (20:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Mar 2021 16:46:24 +0000 (08:46 -0800)
commit7f9eb0bab95e85a1a8062dfb091a44a5f7c6062c
treef211ed15a4860d601f47d07128955875bdffae94
parentf85133526acbd99362f1a99dc0c64ce7e1136a3f
ibmvnic: Fix possibly uninitialized old_num_tx_queues variable warning.

GCC 7.5 reports:
../drivers/net/ethernet/ibm/ibmvnic.c: In function 'ibmvnic_reset_init':
../drivers/net/ethernet/ibm/ibmvnic.c:5373:51: warning: 'old_num_tx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/net/ethernet/ibm/ibmvnic.c:5373:6: warning: 'old_num_rx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized]

The variable is initialized only if(reset) and used only if(reset &&
something) so this is a false positive. However, there is no reason to
not initialize the variables unconditionally avoiding the warning.

Fixes: 1540ac46d0db ("ibmvnic: merge ibmvnic_reset_init and ibmvnic_init")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c