lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260120161200.3590305-3-ikizmaylov@salutedevices.com>
Date: Tue, 20 Jan 2026 19:11:58 +0300
From: Ilias Izmaylov <ikizmaylov@...utedevices.com>
To: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>, Igor Prusov
	<ivprusov@...utedevices.com>, Chen Ni <nichen@...as.ac.cn>
CC: <kernel@...utedevices.com>, Ilias Izmaylov <ikizmaylov@...utedevices.com>,
	<linux-sound@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<rulkc@...uxtesting.org>
Subject: [PATCH v1 2/2] ASoC: codecs: ntp8835: fix snd_soc_component_update_bits handling

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@...utedevices.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ