[PATCH] ASoC: tlv320adc3xxx: Fix buggy return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 sound/soc/codecs/tlv320adc3xxx.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/tlv320adc3xxx.c b/sound/soc/codecs/tlv320adc3xxx.c
index 4baf3d881633..f15e3ea8685c 100644
--- a/sound/soc/codecs/tlv320adc3xxx.c
+++ b/sound/soc/codecs/tlv320adc3xxx.c
@@ -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);
 	u8 clkdir = 0, format = 0;
 	int master = 0;
+	int ret;
 
 	/* set master/slave audio interface */
 	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)
 	adc3xxx->master = master;
 
 	/* set clock direction and format */
-	return snd_soc_component_update_bits(component,
-					     ADC3XXX_INTERFACE_CTRL_1,
-					     ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK,
-					     clkdir | format);
+	ret = snd_soc_component_update_bits(component,
+					    ADC3XXX_INTERFACE_CTRL_1,
+					    ADC3XXX_CLKDIR_MASK | ADC3XXX_FORMAT_MASK,
+					    clkdir | format);
+	if (ret < 0)
+		return ret;
+	return 0;
 }
 
 static const struct snd_soc_dai_ops adc3xxx_dai_ops = {
-- 
2.20.1


-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux