* [rulkc] [PATCH v1 1/2] ASoC: codecs: ntp8918: fix snd_soc_component_update_bits handling
2026-01-20 16:11 [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling ikizmaylov
@ 2026-01-20 16:11 ` ikizmaylov
2026-01-20 16:11 ` [rulkc] [PATCH v1 2/2] ASoC: codecs: ntp8835: " ikizmaylov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ikizmaylov @ 2026-01-20 16:11 UTC (permalink / raw)
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: 2bd61fff3e93b ("ASoC: codecs: Add NeoFidelity NTP8918 codec")
Signed-off-by: Ilias Izmaylov <ikizmaylov at salutedevices.com>
---
sound/soc/codecs/ntp8918.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/ntp8918.c b/sound/soc/codecs/ntp8918.c
index 5593d48ef696f..cc672fd93def4 100644
--- a/sound/soc/codecs/ntp8918.c
+++ b/sound/soc/codecs/ntp8918.c
@@ -233,7 +233,7 @@ static int ntp8918_hw_params(struct snd_pcm_substream *substream,
ret = snd_soc_component_update_bits(component, NTP8918_MCLK_FREQ_CTRL,
NTP8918_MCLK_FREQ_MCF, mcf);
- if (ret)
+ if (ret < 0)
return ret;
switch (ntp8918->format) {
@@ -276,8 +276,11 @@ static int ntp8918_hw_params(struct snd_pcm_substream *substream,
gsa_fmt_mask = NTP8918_GSA_BS_MASK |
NTP8918_GSA_RIGHT_J |
NTP8918_GSA_LSB;
- return snd_soc_component_update_bits(component, NTP8918_GSA_FMT,
- gsa_fmt_mask, gsa_fmt);
+
+ ret = snd_soc_component_update_bits(component, NTP8918_GSA_FMT,
+ gsa_fmt_mask, gsa_fmt);
+
+ return ret < 0 ? ret : 0;
}
static int ntp8918_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
@@ -302,8 +305,12 @@ static int ntp8918_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
unsigned int mute_mask = NTP8918_SOFT_MUTE_SM1 |
NTP8918_SOFT_MUTE_SM2;
- return snd_soc_component_update_bits(dai->component, NTP8918_SOFT_MUTE,
- mute_mask, mute ? mute_mask : 0);
+ int ret = snd_soc_component_update_bits(dai->component,
+ NTP8918_SOFT_MUTE,
+ mute_mask,
+ mute ? mute_mask : 0);
+
+ return ret < 0 ? ret : 0;
}
static const struct snd_soc_dai_ops ntp8918_dai_ops = {
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [rulkc] [PATCH v1 2/2] ASoC: codecs: ntp8835: fix snd_soc_component_update_bits handling
2026-01-20 16:11 [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling ikizmaylov
2026-01-20 16:11 ` [rulkc] [PATCH v1 1/2] ASoC: codecs: ntp8918: fix snd_soc_component_update_bits handling ikizmaylov
@ 2026-01-20 16:11 ` ikizmaylov
2026-02-12 8:08 ` [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling ikizmaylov
2026-02-12 9:39 ` ikizmaylov
3 siblings, 0 replies; 5+ messages in thread
From: ikizmaylov @ 2026-01-20 16:11 UTC (permalink / raw)
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 at 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
^ permalink raw reply [flat|nested] 5+ messages in thread* [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling
2026-01-20 16:11 [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling ikizmaylov
2026-01-20 16:11 ` [rulkc] [PATCH v1 1/2] ASoC: codecs: ntp8918: fix snd_soc_component_update_bits handling ikizmaylov
2026-01-20 16:11 ` [rulkc] [PATCH v1 2/2] ASoC: codecs: ntp8835: " ikizmaylov
@ 2026-02-12 8:08 ` ikizmaylov
2026-02-12 9:39 ` ikizmaylov
3 siblings, 0 replies; 5+ messages in thread
From: ikizmaylov @ 2026-02-12 8:08 UTC (permalink / raw)
Hey!
I noticed that it's been more than two weeks since I submitted this patch series and there is still no reply so I decided to ping you guys just in case
On 1/20/26 19:11, Ilias Izmaylov wrote:
> This patchset fixes the way that snd_soc_component_update_bits
> function's return values are handled by codecs ntp8918 and ntp8835.
>
> Currently the return value "0" is considered erroneous when in fact it
> isn't and what would correctly indicate an error is a negative return
> value.
>
> Ilias Izmaylov (2):
> ASoC: codecs: ntp8918: fix snd_soc_component_update_bits handling
> ASoC: codecs: ntp8835: fix snd_soc_component_update_bits handling
>
> sound/soc/codecs/ntp8835.c | 17 ++++++++++++-----
> sound/soc/codecs/ntp8918.c | 17 ++++++++++++-----
> 2 files changed, 24 insertions(+), 10 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling
2026-01-20 16:11 [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling ikizmaylov
` (2 preceding siblings ...)
2026-02-12 8:08 ` [rulkc] [PATCH v1 0/2] Fix snd_soc_component_update_bits return handling ikizmaylov
@ 2026-02-12 9:39 ` ikizmaylov
3 siblings, 0 replies; 5+ messages in thread
From: ikizmaylov @ 2026-02-12 9:39 UTC (permalink / raw)
Hey!
I noticed that it's been more than two weeks since I submitted this patch series and there is still no reply so I decided to ping you guys just in case
On 1/20/26 19:11, Ilias Izmaylov wrote:
> This patchset fixes the way that snd_soc_component_update_bits
> function's return values are handled by codecs ntp8918 and ntp8835.
>
> Currently the return value "0" is considered erroneous when in fact it
> isn't and what would correctly indicate an error is a negative return
> value.
>
> Ilias Izmaylov (2):
> ASoC: codecs: ntp8918: fix snd_soc_component_update_bits handling
> ASoC: codecs: ntp8835: fix snd_soc_component_update_bits handling
>
> sound/soc/codecs/ntp8835.c | 17 ++++++++++++-----
> sound/soc/codecs/ntp8918.c | 17 ++++++++++++-----
> 2 files changed, 24 insertions(+), 10 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread