Commit 38cc0334 authored by Su Hui's avatar Su Hui Committed by Mark Brown

ASoC: codecs: avoid possible garbage value in peb2466_reg_read()

Clang static checker (scan-build) warning:
sound/soc/codecs/peb2466.c:232:8:
Assigned value is garbage or undefined [core.uninitialized.Assign]
  232 |                 *val = tmp;
      |                      ^ ~~~

When peb2466_read_byte() fails, 'tmp' will have a garbage value.
Add a judgemnet to avoid this problem.

Fixes: 227f609c ("ASoC: codecs: Add support for the Infineon PEB2466 codec")
Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
Link: https://patch.msgid.link/20240911115448.277828-1-suhui@nfschina.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c6b9a922
...@@ -229,6 +229,7 @@ static int peb2466_reg_read(void *context, unsigned int reg, unsigned int *val) ...@@ -229,6 +229,7 @@ static int peb2466_reg_read(void *context, unsigned int reg, unsigned int *val)
case PEB2466_CMD_XOP: case PEB2466_CMD_XOP:
case PEB2466_CMD_SOP: case PEB2466_CMD_SOP:
ret = peb2466_read_byte(peb2466, reg, &tmp); ret = peb2466_read_byte(peb2466, reg, &tmp);
if (!ret)
*val = tmp; *val = tmp;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment