* [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw()
@ 2022-05-23 15:05 Nathan Chancellor
2022-05-24 12:30 ` Arnd Bergmann
2022-06-06 10:58 ` Alexander Lobakin
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-05-23 15:05 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: Nick Desaulniers, linux-kernel, llvm, patches, Nathan Chancellor,
Dan Carpenter, kernel test robot, Tom Rix, Ricky WU
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw()
2022-05-23 15:05 [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw() Nathan Chancellor
@ 2022-05-24 12:30 ` Arnd Bergmann
2022-06-06 10:58 ` Alexander Lobakin
1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2022-05-24 12:30 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Arnd Bergmann, Greg Kroah-Hartman, Nick Desaulniers,
Linux Kernel Mailing List, clang-built-linux, patches,
Dan Carpenter, kernel test robot, Tom Rix, Ricky WU
On Mon, May 23, 2022 at 5:05 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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>
Looks good to me,
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw()
2022-05-23 15:05 [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw() Nathan Chancellor
2022-05-24 12:30 ` Arnd Bergmann
@ 2022-06-06 10:58 ` Alexander Lobakin
2022-06-06 11:22 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Lobakin @ 2022-06-06 10:58 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Alexander Lobakin, Arnd Bergmann, Greg Kroah-Hartman,
Nick Desaulniers, linux-kernel, llvm, patches, Dan Carpenter,
kernel test robot, Tom Rix, Ricky WU
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw()
2022-06-06 10:58 ` Alexander Lobakin
@ 2022-06-06 11:22 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-06 11:22 UTC (permalink / raw)
To: Alexander Lobakin
Cc: Nathan Chancellor, Arnd Bergmann, Nick Desaulniers, linux-kernel,
llvm, patches, Dan Carpenter, kernel test robot, Tom Rix,
Ricky WU
On Mon, Jun 06, 2022 at 12:58:19PM +0200, Alexander Lobakin wrote:
> 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.
Perhaps use a different compiler? :)
It's in my "to apply" queue, will get there hopefully this week, it came
in during the merge window which prevented me from touching it. You
know this...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-06 11:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 15:05 [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw() Nathan Chancellor
2022-05-24 12:30 ` Arnd Bergmann
2022-06-06 10:58 ` Alexander Lobakin
2022-06-06 11:22 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).