* [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning
@ 2023-08-08 12:56 Arnd Bergmann
2023-08-08 15:00 ` Nathan Chancellor
2023-08-08 20:32 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-08-08 12:56 UTC (permalink / raw)
To: Mark Brown, Weidong Wang
Cc: Arnd Bergmann, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
aw88261_reg_update() returns an unintialized error code in the
success path:
sound/soc/codecs/aw88261.c:651:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (aw_dev->prof_cur != aw_dev->prof_index) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/aw88261.c:660:9: note: uninitialized use occurs here
return ret;
^~~
sound/soc/codecs/aw88261.c:651:3: note: remove the 'if' if its condition is always true
if (aw_dev->prof_cur != aw_dev->prof_index) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Return zero instead here.
Fixes: 028a2ae256916 ("ASoC: codecs: Add aw88261 amplifier driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/soc/codecs/aw88261.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
index 82923b454dd47..6e2266b713862 100644
--- a/sound/soc/codecs/aw88261.c
+++ b/sound/soc/codecs/aw88261.c
@@ -652,6 +652,8 @@ static int aw88261_reg_update(struct aw88261 *aw88261, bool force)
ret = aw88261_dev_fw_update(aw88261);
if (ret)
return ret;
+ } else {
+ ret = 0;
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning
2023-08-08 12:56 [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning Arnd Bergmann
@ 2023-08-08 15:00 ` Nathan Chancellor
2023-08-08 20:32 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2023-08-08 15:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Mark Brown, Weidong Wang, Arnd Bergmann, Liam Girdwood,
Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
On Tue, Aug 08, 2023 at 02:56:54PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> aw88261_reg_update() returns an unintialized error code in the
> success path:
>
> sound/soc/codecs/aw88261.c:651:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> if (aw_dev->prof_cur != aw_dev->prof_index) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/codecs/aw88261.c:660:9: note: uninitialized use occurs here
> return ret;
> ^~~
> sound/soc/codecs/aw88261.c:651:3: note: remove the 'if' if its condition is always true
> if (aw_dev->prof_cur != aw_dev->prof_index) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Return zero instead here.
>
> Fixes: 028a2ae256916 ("ASoC: codecs: Add aw88261 amplifier driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Alternatively, it seems like the final 'return ret' can just be replaced
with 'return 0', as every other assignment of ret returns directly if it
is not zero. Regardless:
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> sound/soc/codecs/aw88261.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
> index 82923b454dd47..6e2266b713862 100644
> --- a/sound/soc/codecs/aw88261.c
> +++ b/sound/soc/codecs/aw88261.c
> @@ -652,6 +652,8 @@ static int aw88261_reg_update(struct aw88261 *aw88261, bool force)
> ret = aw88261_dev_fw_update(aw88261);
> if (ret)
> return ret;
> + } else {
> + ret = 0;
> }
> }
>
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning
2023-08-08 12:56 [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning Arnd Bergmann
2023-08-08 15:00 ` Nathan Chancellor
@ 2023-08-08 20:32 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-08-08 20:32 UTC (permalink / raw)
To: Weidong Wang, Arnd Bergmann
Cc: Arnd Bergmann, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
On Tue, 08 Aug 2023 14:56:54 +0200, Arnd Bergmann wrote:
> aw88261_reg_update() returns an unintialized error code in the
> success path:
>
> sound/soc/codecs/aw88261.c:651:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> if (aw_dev->prof_cur != aw_dev->prof_index) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/codecs/aw88261.c:660:9: note: uninitialized use occurs here
> return ret;
> ^~~
> sound/soc/codecs/aw88261.c:651:3: note: remove the 'if' if its condition is always true
> if (aw_dev->prof_cur != aw_dev->prof_index) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: codecs: aw88261: avoid uninitialized variable warning
commit: 87b56172431bc2e8c497d2f10ee8245313167bd9
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-08 20:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 12:56 [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning Arnd Bergmann
2023-08-08 15:00 ` Nathan Chancellor
2023-08-08 20:32 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox