Skip to content

Commit

Permalink
ASoC: mchp-spdifrx: Fix uninitialized use of mr in mchp_spdifrx_hw_pa…
Browse files Browse the repository at this point in the history
…rams()

stable inclusion
from stable-v5.10.173
commit b4d74716da0079ce6c8241e8ad74c7b14450efe8
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8BFR3

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b4d74716da0079ce6c8241e8ad74c7b14450efe8

--------------------------------

[ Upstream commit 218674a ]

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: fa09fa6 ("ASoC: mchp-spdifrx: fix controls which rely on rsr register")
Link: ClangBuiltLinux/linux#1797
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230202-mchp-spdifrx-fix-uninit-mr-v1-1-629a045d7a2f@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: sanglipeng <sanglipeng1@jd.com>
  • Loading branch information
nathanchance authored and sanglipeng1 committed Oct 30, 2023
1 parent 4e7d793 commit ed85e9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/atmel/mchp-spdifrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,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",
Expand Down

0 comments on commit ed85e9c

Please sign in to comment.