All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: tlv320adc3xxx: Fix buggy return value
@ 2022-02-24  9:29 Ricard Wanderlof
  2022-02-24 18:52 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Ricard Wanderlof @ 2022-02-24  9:29 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, kernel


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>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: tlv320adc3xxx: Fix buggy return value
  2022-02-24  9:29 [PATCH] ASoC: tlv320adc3xxx: Fix buggy return value Ricard Wanderlof
@ 2022-02-24 18:52 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-02-24 18:52 UTC (permalink / raw)
  To: Liam Girdwood, Ricard Wanderlof; +Cc: alsa-devel, kernel

On Thu, 24 Feb 2022 10:29:05 +0100, Ricard Wanderlof wrote:
> 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.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-linus

Thanks!

[1/1] ASoC: tlv320adc3xxx: Fix buggy return value
      commit: eb8b5af702ca0b9adbccec1ddd944a282c57aa66

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-24 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24  9:29 [PATCH] ASoC: tlv320adc3xxx: Fix buggy return value Ricard Wanderlof
2022-02-24 18:52 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.