diff options
| author | Jan Dakinevich <jan.dakinevich@salutedevices.com> | 2025-06-24 16:36:18 +0300 |
|---|---|---|
| committer | Dmitry Rokosov <rockosov@rulkc.org> | 2026-08-13 14:41:35 +0300 |
| commit | 19a8af03a4658d422f2751aa231cb46bed156720 (patch) | |
| tree | 5b60c7244b218d3f86f981f5929cd8702a66287d | |
| parent | 9dfc2c84763ec1506125167feb467e8b4330320a (diff) | |
| download | linux-19a8af03a4658d422f2751aa231cb46bed156720.tar.gz linux-19a8af03a4658d422f2751aa231cb46bed156720.zip | |
ASoC: es7243e: fix using of snd_soc_component_update_bits()
- don't directly pass return value of the function to callers of this
driver. This function can return 1, it is is not-negative but it
doesn't indicate and error.
- add missing assignments.
Fixes: 9f1305e69029 ("ASoC: codecs: add ES7243E ADC driver")
Signed-off-by: Jan Dakinevich <jan.dakinevich@salutedevices.com>
Signed-off-by: Dmitry Rokosov <rockosov@rulkc.org>
| -rw-r--r-- | sound/soc/codecs/es7243e.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/sound/soc/codecs/es7243e.c b/sound/soc/codecs/es7243e.c index cfaf705eff74..fc9239c6030b 100644 --- a/sound/soc/codecs/es7243e.c +++ b/sound/soc/codecs/es7243e.c @@ -306,8 +306,12 @@ static int es7243e_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) if (ret < 0) return ret; - return snd_soc_component_update_bits(component, ES7243E_SDP, - ES7243E_SDP_LRP, sdpfmt); + ret = snd_soc_component_update_bits(component, ES7243E_SDP, + ES7243E_SDP_LRP, sdpfmt); + if (ret < 0) + return ret; + + return 0; } static int es7243e_pcm_startup(struct snd_pcm_substream *substream, @@ -404,16 +408,25 @@ static int es7243e_pcm_hw_params(struct snd_pcm_substream *substream, */ fsleep(50 * USEC_PER_MSEC); val = FIELD_PREP(ES7243E_SDP_MUTE, 0); - return snd_soc_component_update_bits(component, ES7243E_SDP, - ES7243E_SDP_MUTE, val); + ret = snd_soc_component_update_bits(component, ES7243E_SDP, + ES7243E_SDP_MUTE, val); + if (ret < 0) + return ret; + + return 0; } static int es7243e_mute(struct snd_soc_dai *dai, int mute, int direction) { const int val = FIELD_PREP(ES7243E_SDP_MUTE, 3 * !!mute); + int ret; - return snd_soc_component_update_bits(dai->component, ES7243E_SDP, - ES7243E_SDP_MUTE, val); + ret = snd_soc_component_update_bits(dai->component, ES7243E_SDP, + ES7243E_SDP_MUTE, val); + if (ret < 0) + return ret; + + return 0; } static const DECLARE_TLV_DB_RANGE(pga_scale, @@ -576,14 +589,14 @@ static int es7243e_resume(struct snd_soc_component *component) return ret; val = FIELD_PREP(ES7243E_PGA1_EN, 1); - snd_soc_component_update_bits(component, ES7243E_PGA1, - ES7243E_PGA1_EN, val); + ret = snd_soc_component_update_bits(component, ES7243E_PGA1, + ES7243E_PGA1_EN, val); if (ret < 0) return ret; val = FIELD_PREP(ES7243E_PGA2_EN, 1); - snd_soc_component_update_bits(component, ES7243E_PGA2, - ES7243E_PGA2_EN, val); + ret = snd_soc_component_update_bits(component, ES7243E_PGA2, + ES7243E_PGA2_EN, val); if (ret < 0) return ret; |
