mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	patches@lists.linux.dev, Dan Carpenter <dan.carpenter@oracle.com>,
	kernel test robot <lkp@intel.com>, Tom Rix <trix@redhat.com>,
	Ricky WU <ricky_wu@realtek.com>
Subject: Re: [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw()
Date: Mon,  6 Jun 2022 12:58:19 +0200	[thread overview]
Message-ID: <20220606105819.349320-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <20220523150521.2947108-1-nathan@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>
Date: Mon, 23 May 2022 08:05:22 -0700

> Clang warns:
> 
>   drivers/misc/cardreader/rts5261.c:406:13: error: variable 'setting_reg2' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
>           } else if (efuse_valid == 0) {
>                      ^~~~~~~~~~~~~~~~
>   drivers/misc/cardreader/rts5261.c:412:30: note: uninitialized use occurs here
>           pci_read_config_dword(pdev, setting_reg2, &lval2);
>                                       ^~~~~~~~~~~~
> 
> efuse_valid == 1 is not a valid value so just return early from the
> function to avoid using setting_reg2 uninitialized.
> 
> Fixes: b1c5f3085149 ("misc: rtsx: add rts5261 efuse function")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Tom Rix <trix@redhat.com>
> Suggested-by: Ricky WU <ricky_wu@realtek.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Ping? Mainline 5.19-rc1 is now broken due to this.

> ---
> 
> This is basically a v2 of https://lore.kernel.org/20220516130047.3887590-1-trix@redhat.com/.
> 
>  drivers/misc/cardreader/rts5261.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/misc/cardreader/rts5261.c b/drivers/misc/cardreader/rts5261.c
> index 749cc5a46d13..b1e76030cafd 100644
> --- a/drivers/misc/cardreader/rts5261.c
> +++ b/drivers/misc/cardreader/rts5261.c
> @@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr)
>  		// default
>  		setting_reg1 = PCR_SETTING_REG1;
>  		setting_reg2 = PCR_SETTING_REG2;
> +	} else {
> +		return;
>  	}
>  
>  	pci_read_config_dword(pdev, setting_reg2, &lval2);
> 
> base-commit: 90de6805267f8c79cd2b1a36805071e257c39b5c
> -- 
> 2.36.1

Thanks,
Al

  parent reply	other threads:[~2022-06-06 10:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 15:05 Nathan Chancellor
2022-05-24 12:30 ` Arnd Bergmann
2022-06-06 10:58 ` Alexander Lobakin [this message]
2022-06-06 11:22   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220606105819.349320-1-alexandr.lobakin@intel.com \
    --to=alexandr.lobakin@intel.com \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=patches@lists.linux.dev \
    --cc=ricky_wu@realtek.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®