Skip to content

Commit eb8b5af

Browse files
Ricard Wanderlofbroonie
authored andcommitted
ASoC: tlv320adc3xxx: Fix buggy return value
snd_soc_component_update_bits returns 1 if the operation was successful and some bits were changed, so we cannot return this value directly as it can be interpreted as an error. Instead, do some minor mangling to avoid inadvertently returning an error. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Link: https://lore.kernel.org/r/alpine.DEB.2.21.2202241021420.20760@lnxricardw1.se.axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c07ac3e commit eb8b5af

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

sound/soc/codecs/tlv320adc3xxx.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,7 @@ static int adc3xxx_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
11111111
struct adc3xxx *adc3xxx = snd_soc_component_get_drvdata(component);
11121112
u8 clkdir = 0, format = 0;
11131113
int master = 0;
1114+
int ret;
11141115

11151116
/* set master/slave audio interface */
11161117
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -1161,10 +1162,13 @@ static int adc3xxx_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
11611162
adc3xxx->master = master;
11621163

11631164
/* set clock direction and format */
1164-
return snd_soc_component_update_bits(component,
1165-
ADC3XXX_INTERFACE_CTRL_1,
1166-
ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK,
1167-
clkdir | format);
1165+
ret = snd_soc_component_update_bits(component,
1166+
ADC3XXX_INTERFACE_CTRL_1,
1167+
ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK,
1168+
clkdir | format);
1169+
if (ret < 0)
1170+
return ret;
1171+
return 0;
11681172
}
11691173

11701174
static const struct snd_soc_dai_ops adc3xxx_dai_ops = {

0 commit comments

Comments
 (0)