Skip to content

Commit

Permalink
ASoC: nau8821: check regmap_raw_read/regmap_raw_write for failure
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
Link: https://patch.msgid.link/20241018110743.18786-1-v.shevtsov@maxima.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Vitaliy Shevtsov authored and Mark Brown committed Oct 18, 2024
1 parent b2385de commit 1b9971a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sound/soc/codecs/nau8821.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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[] = {
Expand Down

0 comments on commit 1b9971a

Please sign in to comment.