未验证 提交 eb8b5af7 编写于 作者: R Ricard Wanderlof 提交者: Mark Brown

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: NRicard Wanderlof <ricardw@axis.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2202241021420.20760@lnxricardw1.se.axis.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 c07ac3ee
...@@ -1111,6 +1111,7 @@ static int adc3xxx_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -1111,6 +1111,7 @@ static int adc3xxx_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
struct adc3xxx *adc3xxx = snd_soc_component_get_drvdata(component); struct adc3xxx *adc3xxx = snd_soc_component_get_drvdata(component);
u8 clkdir = 0, format = 0; u8 clkdir = 0, format = 0;
int master = 0; int master = 0;
int ret;
/* set master/slave audio interface */ /* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 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) ...@@ -1161,10 +1162,13 @@ static int adc3xxx_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
adc3xxx->master = master; adc3xxx->master = master;
/* set clock direction and format */ /* set clock direction and format */
return snd_soc_component_update_bits(component, ret = snd_soc_component_update_bits(component,
ADC3XXX_INTERFACE_CTRL_1, ADC3XXX_INTERFACE_CTRL_1,
ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK, ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK,
clkdir | format); clkdir | format);
if (ret < 0)
return ret;
return 0;
} }
static const struct snd_soc_dai_ops adc3xxx_dai_ops = { static const struct snd_soc_dai_ops adc3xxx_dai_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册