diff mbox series

ASoC: mchp-spdifrx: Fix uninitialized use of mr in mchp_spdifrx_hw_params()

Message ID 20230202-mchp-spdifrx-fix-uninit-mr-v1-1-629a045d7a2f@kernel.org (mailing list archive)
State Accepted
Commit 218674a45930c700486d27b765bf2f1b43f8cbf7
Headers show
Series ASoC: mchp-spdifrx: Fix uninitialized use of mr in mchp_spdifrx_hw_params() | expand

Commit Message

Nathan Chancellor Feb. 2, 2023, 4:34 p.m. UTC
Clang warns:

  ../sound/soc/atmel/mchp-spdifrx.c:455:3: error: variable 'mr' is uninitialized when used here [-Werror,-Wuninitialized]
                  mr |= SPDIFRX_MR_ENDIAN_BIG;
                  ^~
  ../sound/soc/atmel/mchp-spdifrx.c:432:8: note: initialize the variable 'mr' to silence this warning
          u32 mr;
                ^
                 = 0
  1 error generated.

Zero initialize mr so that these bitwise OR and assignment operation
works unconditionally.

Fixes: fa09fa60385a ("ASoC: mchp-spdifrx: fix controls which rely on rsr register")
Link: https://github.com/ClangBuiltLinux/linux/issues/1797
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 sound/soc/atmel/mchp-spdifrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 1d78f19d90d1932c83d8c96c6f86fbb06c05e29a
change-id: 20230202-mchp-spdifrx-fix-uninit-mr-80528f2024c9

Best regards,

Comments

Claudiu Beznea Feb. 2, 2023, 4:56 p.m. UTC | #1
On 02.02.2023 18:34, Nathan Chancellor wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Clang warns:
> 
>   ../sound/soc/atmel/mchp-spdifrx.c:455:3: error: variable 'mr' is uninitialized when used here [-Werror,-Wuninitialized]
>                   mr |= SPDIFRX_MR_ENDIAN_BIG;
>                   ^~
>   ../sound/soc/atmel/mchp-spdifrx.c:432:8: note: initialize the variable 'mr' to silence this warning
>           u32 mr;
>                 ^
>                  = 0
>   1 error generated.
> 
> Zero initialize mr so that these bitwise OR and assignment operation
> works unconditionally.
> 
> Fixes: fa09fa60385a ("ASoC: mchp-spdifrx: fix controls which rely on rsr register")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1797
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  sound/soc/atmel/mchp-spdifrx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c
> index 526dd3a17471..eb0c0ef4541e 100644
> --- a/sound/soc/atmel/mchp-spdifrx.c
> +++ b/sound/soc/atmel/mchp-spdifrx.c
> @@ -429,7 +429,7 @@ static int mchp_spdifrx_hw_params(struct snd_pcm_substream *substream,
>                                   struct snd_soc_dai *dai)
>  {
>         struct mchp_spdifrx_dev *dev = snd_soc_dai_get_drvdata(dai);
> -       u32 mr;
> +       u32 mr = 0;
>         int ret;
> 
>         dev_dbg(dev->dev, "%s() rate=%u format=%#x width=%u channels=%u\n",
> 
> ---
> base-commit: 1d78f19d90d1932c83d8c96c6f86fbb06c05e29a
> change-id: 20230202-mchp-spdifrx-fix-uninit-mr-80528f2024c9
> 
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
Mark Brown Feb. 2, 2023, 8:15 p.m. UTC | #2
On Thu, 02 Feb 2023 09:34:19 -0700, Nathan Chancellor wrote:
> Clang warns:
> 
>   ../sound/soc/atmel/mchp-spdifrx.c:455:3: error: variable 'mr' is uninitialized when used here [-Werror,-Wuninitialized]
>                   mr |= SPDIFRX_MR_ENDIAN_BIG;
>                   ^~
>   ../sound/soc/atmel/mchp-spdifrx.c:432:8: note: initialize the variable 'mr' to silence this warning
>           u32 mr;
>                 ^
>                  = 0
>   1 error generated.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: mchp-spdifrx: Fix uninitialized use of mr in mchp_spdifrx_hw_params()
      commit: 218674a45930c700486d27b765bf2f1b43f8cbf7

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/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c
index 526dd3a17471..eb0c0ef4541e 100644
--- a/sound/soc/atmel/mchp-spdifrx.c
+++ b/sound/soc/atmel/mchp-spdifrx.c
@@ -429,7 +429,7 @@  static int mchp_spdifrx_hw_params(struct snd_pcm_substream *substream,
 				  struct snd_soc_dai *dai)
 {
 	struct mchp_spdifrx_dev *dev = snd_soc_dai_get_drvdata(dai);
-	u32 mr;
+	u32 mr = 0;
 	int ret;
 
 	dev_dbg(dev->dev, "%s() rate=%u format=%#x width=%u channels=%u\n",