diff mbox series

ASoC: codecs: aw88399: Fix -Wuninitialized in aw_dev_set_vcalb()

Message ID 20231027-asoc-aw88399-fix-wuninitialized-v1-1-b1044493e4cd@kernel.org (mailing list archive)
State Accepted
Commit cba4590036855f4e3110d43c14385d2401080dbb
Headers show
Series ASoC: codecs: aw88399: Fix -Wuninitialized in aw_dev_set_vcalb() | expand

Commit Message

Nathan Chancellor Oct. 27, 2023, 4:54 p.m. UTC
Clang warns (or errors with CONFIG_WERROR=y):

  sound/soc/codecs/aw88399.c:441:18: error: variable 'vsense_select' is uninitialized when used here [-Werror,-Wuninitialized]
    441 |         vsense_select = vsense_select & (~AW88399_VDSEL_MASK);
        |                         ^~~~~~~~~~~~~
  sound/soc/codecs/aw88399.c:431:28: note: initialize the variable 'vsense_select' to silence this warning
    431 |         unsigned int vsense_select, vsense_value;
        |                                   ^
        |                                    = 0
  1 error generated.

This clearly should have been using the value received from
regmap_read(). Use the correct variable to resolve the warning.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1952
Fixes: 8ade6cc7e261 ("ASoC: codecs: Add aw88399 amplifier driver")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 sound/soc/codecs/aw88399.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 60781d2d5899d6fc5fd173c1bcffaaec39643e17
change-id: 20231027-asoc-aw88399-fix-wuninitialized-63b554f8fa9a

Best regards,

Comments

wangweidong.a@awinic.com Oct. 30, 2023, 2:28 a.m. UTC | #1
Hi, Nathan

On Fri, 27 Oct 2023 09:54:25 -0700 nathan@kernel.org wrote:

> Clang warns (or errors with CONFIG_WERROR=y):

>  sound/soc/codecs/aw88399.c:441:18: error: variable 'vsense_select' is uninitialized when used here [-Werror,-Wuninitialized]
>    441 |         vsense_select = vsense_select & (~AW88399_VDSEL_MASK);
>        |                         ^~~~~~~~~~~~~
>  sound/soc/codecs/aw88399.c:431:28: note: initialize the variable 'vsense_select' to silence this warning
>    431 |         unsigned int vsense_select, vsense_value;
>        |                                   ^
>        |                                    = 0
>  1 error generated.

> This clearly should have been using the value received from
> regmap_read(). Use the correct variable to resolve the warning.

> Closes: https://github.com/ClangBuiltLinux/linux/issues/1952
> Fixes: 8ade6cc7e261 ("ASoC: codecs: Add aw88399 amplifier driver")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> sound/soc/codecs/aw88399.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Thank you very much for your patch.

Reviewed-by: Weidong Wang <wangweidong.a@awinic.com>

Best regards,
Weidong Wang
Mark Brown Oct. 30, 2023, 7:20 p.m. UTC | #2
On Fri, 27 Oct 2023 09:54:25 -0700, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y):
> 
>   sound/soc/codecs/aw88399.c:441:18: error: variable 'vsense_select' is uninitialized when used here [-Werror,-Wuninitialized]
>     441 |         vsense_select = vsense_select & (~AW88399_VDSEL_MASK);
>         |                         ^~~~~~~~~~~~~
>   sound/soc/codecs/aw88399.c:431:28: note: initialize the variable 'vsense_select' to silence this warning
>     431 |         unsigned int vsense_select, vsense_value;
>         |                                   ^
>         |                                    = 0
>   1 error generated.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: aw88399: Fix -Wuninitialized in aw_dev_set_vcalb()
      commit: cba4590036855f4e3110d43c14385d2401080dbb

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
Mark Brown Nov. 6, 2023, 1:03 p.m. UTC | #3
On Fri, 27 Oct 2023 09:54:25 -0700, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y):
> 
>   sound/soc/codecs/aw88399.c:441:18: error: variable 'vsense_select' is uninitialized when used here [-Werror,-Wuninitialized]
>     441 |         vsense_select = vsense_select & (~AW88399_VDSEL_MASK);
>         |                         ^~~~~~~~~~~~~
>   sound/soc/codecs/aw88399.c:431:28: note: initialize the variable 'vsense_select' to silence this warning
>     431 |         unsigned int vsense_select, vsense_value;
>         |                                   ^
>         |                                    = 0
>   1 error generated.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: aw88399: Fix -Wuninitialized in aw_dev_set_vcalb()
      commit: cba4590036855f4e3110d43c14385d2401080dbb

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
diff mbox series

Patch

diff --git a/sound/soc/codecs/aw88399.c b/sound/soc/codecs/aw88399.c
index ce30bc7cdea9..47fe38d0def5 100644
--- a/sound/soc/codecs/aw88399.c
+++ b/sound/soc/codecs/aw88399.c
@@ -438,7 +438,7 @@  static int aw_dev_set_vcalb(struct aw88399 *aw88399)
 	if (ret)
 		return ret;
 
-	vsense_select = vsense_select & (~AW88399_VDSEL_MASK);
+	vsense_select = vsense_value & (~AW88399_VDSEL_MASK);
 
 	ret = aw88399_dev_get_icalk(aw88399, &icalk);
 	if (ret) {