diff mbox series

[net-next] net: ngbe: Variables need to be initialized

Message ID 20221009070912.55353-1-mengyuanlou@net-swift.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ngbe: Variables need to be initialized | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 5 maintainers not CCed: kuba@kernel.org davem@davemloft.net christophe.jaillet@wanadoo.fr edumazet@google.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Mengyuan Lou Oct. 9, 2022, 7:09 a.m. UTC
Variables need to be initialized in ngbe_shutdown()
Fix: commit <e79e40c83b9f> ("net: ngbe: Add build support for ngbe")

Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
---
 drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Oct. 11, 2022, 12:44 a.m. UTC | #1
On Sun,  9 Oct 2022 15:09:12 +0800 Mengyuan Lou wrote:
> Variables need to be initialized in ngbe_shutdown()
> Fix: commit <e79e40c83b9f> ("net: ngbe: Add build support for ngbe")

Please look at the git history to find out what the correct form is for
the Fixes tag.

> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
> ---
>  drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> index 7674cb6e5700..f754e53eb852 100644
> --- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> +++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> @@ -46,7 +46,7 @@ static void ngbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
>  
>  static void ngbe_shutdown(struct pci_dev *pdev)
>  {
> -	bool wake;
> +	bool wake = false;
>  
>  	ngbe_dev_shutdown(pdev, &wake);

The callee should make sure to always write to the variable, caller
init is a worse fix.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index 7674cb6e5700..f754e53eb852 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -46,7 +46,7 @@  static void ngbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
 
 static void ngbe_shutdown(struct pci_dev *pdev)
 {
-	bool wake;
+	bool wake = false;
 
 	ngbe_dev_shutdown(pdev, &wake);