mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilias Izmaylov <ikizmaylov@salutedevices.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Igor Prusov <ivprusov@salutedevices.com>,
	Chen Ni <nichen@iscas.ac.cn>
Cc: <kernel@salutedevices.com>,
	Ilias Izmaylov <ikizmaylov@salutedevices.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<rulkc@linuxtesting.org>
Subject: [PATCH v1 2/2] ASoC: codecs: ntp8835: fix snd_soc_component_update_bits handling
Date: Tue, 20 Jan 2026 19:11:58 +0300	[thread overview]
Message-ID: <20260120161200.3590305-3-ikizmaylov@salutedevices.com> (raw)
In-Reply-To: <20260120161200.3590305-1-ikizmaylov@salutedevices.com>

Add less-than-0 snd_soc_component_update_bits checks to determine
whether it resulted in error or not, since if it returns a positive
number it doesn't mean that there was a failure - only a negative
result indicates an error

Fixes: dc9004ea273a9 ("ASoC: codecs: Add NeoFidelity NTP8835 codec")
Signed-off-by: Ilias Izmaylov <ikizmaylov@salutedevices.com>
---
 sound/soc/codecs/ntp8835.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/ntp8835.c b/sound/soc/codecs/ntp8835.c
index 45f99c9d20c77..75426262e9bae 100644
--- a/sound/soc/codecs/ntp8835.c
+++ b/sound/soc/codecs/ntp8835.c
@@ -274,7 +274,7 @@ static int ntp8835_hw_params(struct snd_pcm_substream *substream,
 
 	ret = snd_soc_component_update_bits(component, NTP8835_MCLK_FREQ_CTRL,
 					    NTP8835_MCLK_FREQ_MCF, mcf);
-	if (ret)
+	if (ret < 0)
 		return ret;
 
 	switch (ntp8835->format) {
@@ -317,8 +317,10 @@ static int ntp8835_hw_params(struct snd_pcm_substream *substream,
 	gsa_fmt_mask = NTP8835_GSA_BS_MASK |
 		       NTP8835_GSA_RIGHT_J |
 		       NTP8835_GSA_LSB;
-	return snd_soc_component_update_bits(component, NTP8835_GSA_FMT,
-					     gsa_fmt_mask, gsa_fmt);
+	ret = snd_soc_component_update_bits(component, NTP8835_GSA_FMT,
+					    gsa_fmt_mask, gsa_fmt);
+
+	return ret < 0 ? ret : 0;
 }
 
 static int ntp8835_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
@@ -343,8 +345,13 @@ static int ntp8835_mute(struct snd_soc_dai *dai, int mute, int stream)
 	unsigned int mute_mask = NTP8835_SOFT_MUTE_SM1 |
 				 NTP8835_SOFT_MUTE_SM2 |
 				 NTP8835_SOFT_MUTE_SM3;
-	return snd_soc_component_update_bits(dai->component, NTP8835_SOFT_MUTE,
-					     mute_mask, mute ? mute_mask : 0);
+
+	int ret =  snd_soc_component_update_bits(dai->component,
+						 NTP8835_SOFT_MUTE,
+						 mute_mask,
+						 mute ? mute_mask : 0);
+
+	return ret < 0 ? ret : 0;
 }
 
 static const struct snd_soc_dai_ops ntp8835_dai_ops = {
-- 
2.47.3


  parent reply	other threads:[~2026-01-20 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 16:11 [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling Ilias Izmaylov
2026-01-20 16:11 ` [PATCH v1 1/2] ASoC: codecs: ntp8918: fix snd_soc_component_update_bits handling Ilias Izmaylov
2026-01-20 16:11 ` Ilias Izmaylov [this message]
2026-02-12  8:08 ` [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling Ilias Izmaylov
2026-02-12  9:39 ` Ilias Izmaylov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260120161200.3590305-3-ikizmaylov@salutedevices.com \
    --to=ikizmaylov@salutedevices.com \
    --cc=broonie@kernel.org \
    --cc=ivprusov@salutedevices.com \
    --cc=kernel@salutedevices.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=perex@perex.cz \
    --cc=rulkc@linuxtesting.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®