From: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
To: Liam Girdwood <lgirdwood@gmail.com>
Cc: "Vitaliy Shevtsov" <v.shevtsov@maxima.ru>,
"Mark Brown" <broonie@kernel.org>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>, "Seven Lee" <wtli@nuvoton.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: [PATCH] ASoC: nau8821: check regmap_raw_read/regmap_raw_write for failure
Date: Fri, 18 Oct 2024 16:07:41 +0500 [thread overview]
Message-ID: <20241018110743.18786-1-v.shevtsov@maxima.ru> (raw)
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
next reply other threads:[~2024-10-18 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 11:07 Vitaliy Shevtsov [this message]
2024-10-18 11:36 ` [PATCH] ASoC: nau8821: check regmap_raw_read/regmap_raw_write for failure Andy Shevchenko
2024-10-18 20:01 ` Mark Brown
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=20241018110743.18786-1-v.shevtsov@maxima.ru \
--to=v.shevtsov@maxima.ru \
--cc=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wtli@nuvoton.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