The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ASoC: nau8821: check regmap_raw_read/regmap_raw_write for failure
@ 2024-10-18 11:07 Vitaliy Shevtsov
  2024-10-18 11:36 ` Andy Shevchenko
  2024-10-18 20:01 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Vitaliy Shevtsov @ 2024-10-18 11:07 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Vitaliy Shevtsov, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Seven Lee, Uwe Kleine-König, Andy Shevchenko, linux-sound,
	linux-kernel, lvc-project

The return values from both regmap_raw_read() and regmap_raw_write() are not
checked despite they can fail. Propagate possible errors to caller.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Fixes: aab1ad11d69f ("ASoC: nau8821: new driver")
Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
---
 sound/soc/codecs/nau8821.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index de5c4db05c8f..edb95f869a4a 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -287,10 +287,8 @@ static int nau8821_biq_coeff_get(struct snd_kcontrol *kcontrol,
 	if (!component->regmap)
 		return -EINVAL;
 
-	regmap_raw_read(component->regmap, NAU8821_R21_BIQ0_COF1,
+	return regmap_raw_read(component->regmap, NAU8821_R21_BIQ0_COF1,
 		ucontrol->value.bytes.data, params->max);
-
-	return 0;
 }
 
 static int nau8821_biq_coeff_put(struct snd_kcontrol *kcontrol,
@@ -299,6 +297,7 @@ static int nau8821_biq_coeff_put(struct snd_kcontrol *kcontrol,
 	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
 	struct soc_bytes_ext *params = (void *)kcontrol->private_value;
 	void *data;
+	int ret;
 
 	if (!component->regmap)
 		return -EINVAL;
@@ -308,12 +307,12 @@ static int nau8821_biq_coeff_put(struct snd_kcontrol *kcontrol,
 	if (!data)
 		return -ENOMEM;
 
-	regmap_raw_write(component->regmap, NAU8821_R21_BIQ0_COF1,
+	ret = regmap_raw_write(component->regmap, NAU8821_R21_BIQ0_COF1,
 		data, params->max);
 
 	kfree(data);
 
-	return 0;
+	return ret;
 }
 
 static const char * const nau8821_adc_decimation[] = {
-- 
2.46.2


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

end of thread, other threads:[~2024-10-18 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 11:07 [PATCH] ASoC: nau8821: check regmap_raw_read/regmap_raw_write for failure Vitaliy Shevtsov
2024-10-18 11:36 ` Andy Shevchenko
2024-10-18 20:01 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox