Skip to content

Commit 38cc033

Browse files
Su Huibroonie
authored andcommitted
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: 227f609 ("ASoC: codecs: Add support for the Infineon PEB2466 codec") Signed-off-by: Su Hui <suhui@nfschina.com> Link: https://patch.msgid.link/20240911115448.277828-1-suhui@nfschina.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c6b9a92 commit 38cc033

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/soc/codecs/peb2466.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ static int peb2466_reg_read(void *context, unsigned int reg, unsigned int *val)
229229
case PEB2466_CMD_XOP:
230230
case PEB2466_CMD_SOP:
231231
ret = peb2466_read_byte(peb2466, reg, &tmp);
232-
*val = tmp;
232+
if (!ret)
233+
*val = tmp;
233234
break;
234235
default:
235236
dev_err(&peb2466->spi->dev, "Not a XOP or SOP command\n");

0 commit comments

Comments
 (0)