Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: es8328: Propagate error codes from regmap updates

In es8328_hw_params(), the return value of
snd_soc_component_update_bits() was ignored. This could lead to silent
failures where the hardware is left in an inconsistent state if a
regmap write fails.

Check the return value of regmap updates and propagate any errors back
to the ALSA core. Return 0 on success to match the DAI ops convention.

Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
Link: https://patch.msgid.link/20260115161359.41979-1-hungen3108@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Hsieh Hung-En and committed by
Mark Brown
4711b292 61d2a769

+23 -11
+23 -11
sound/soc/codecs/es8328.c
··· 461 461 { 462 462 struct snd_soc_component *component = dai->component; 463 463 struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component); 464 + int ret; 464 465 int i; 465 466 int reg; 466 467 int wl; ··· 495 494 es8328->mclkdiv2 = 0; 496 495 } 497 496 498 - snd_soc_component_update_bits(component, ES8328_MASTERMODE, 499 - ES8328_MASTERMODE_MCLKDIV2, 500 - es8328->mclkdiv2 ? ES8328_MASTERMODE_MCLKDIV2 : 0); 497 + ret = snd_soc_component_update_bits(component, ES8328_MASTERMODE, 498 + ES8328_MASTERMODE_MCLKDIV2, 499 + es8328->mclkdiv2 ? 500 + ES8328_MASTERMODE_MCLKDIV2 : 0); 501 + if (ret < 0) 502 + return ret; 501 503 502 504 switch (params_width(params)) { 503 505 case 16: ··· 523 519 } 524 520 525 521 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 526 - snd_soc_component_update_bits(component, ES8328_DACCONTROL1, 527 - ES8328_DACCONTROL1_DACWL_MASK, 528 - wl << ES8328_DACCONTROL1_DACWL_SHIFT); 522 + ret = snd_soc_component_update_bits(component, ES8328_DACCONTROL1, 523 + ES8328_DACCONTROL1_DACWL_MASK, 524 + wl << ES8328_DACCONTROL1_DACWL_SHIFT); 525 + if (ret < 0) 526 + return ret; 529 527 530 528 es8328->playback_fs = params_rate(params); 531 529 es8328_set_deemph(component); 532 - } else 533 - snd_soc_component_update_bits(component, ES8328_ADCCONTROL4, 534 - ES8328_ADCCONTROL4_ADCWL_MASK, 535 - wl << ES8328_ADCCONTROL4_ADCWL_SHIFT); 530 + } else { 531 + ret = snd_soc_component_update_bits(component, ES8328_ADCCONTROL4, 532 + ES8328_ADCCONTROL4_ADCWL_MASK, 533 + wl << ES8328_ADCCONTROL4_ADCWL_SHIFT); 534 + if (ret < 0) 535 + return ret; 536 + } 536 537 537 - return snd_soc_component_update_bits(component, reg, ES8328_RATEMASK, ratio); 538 + ret = snd_soc_component_update_bits(component, reg, ES8328_RATEMASK, ratio); 539 + if (ret < 0) 540 + return ret; 541 + return 0; 538 542 } 539 543 540 544 static int es8328_set_sysclk(struct snd_soc_dai *codec_dai,