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

From: Jakub Kicinski <[email-masked]>
Date: Mon, 10 Oct 2022 17:44:43 -0700

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 <[email-masked]>
> ---
>  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.