diff options
author | Tzung-Bi Shih <tzungbi@google.com> | 2020-12-24 13:06:04 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-12-29 16:18:46 +0300 |
commit | bf1eb056ac15a058fb5e254307f14f45efbe79d8 (patch) | |
tree | f3758e5e62085a69317910040258c1a5770fbdd1 /sound/soc/codecs/rt1015.c | |
parent | 4ac275eda0d7bf6f222ad0093ffbdfd2f4228eaa (diff) | |
download | linux-bf1eb056ac15a058fb5e254307f14f45efbe79d8.tar.xz |
ASoC: rt1015: save boost_mode only if valid
Saves boost_mode only if valid. Also returns -EINVAL if it is invalid.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224100607.3006171-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt1015.c')
-rw-r--r-- | sound/soc/codecs/rt1015.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c index e78364f54451..3b9db3a1a3bc 100644 --- a/sound/soc/codecs/rt1015.c +++ b/sound/soc/codecs/rt1015.c @@ -444,10 +444,9 @@ static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol, snd_soc_kcontrol_component(kcontrol); struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component); + int boost_mode = ucontrol->value.integer.value[0]; - rt1015->boost_mode = ucontrol->value.integer.value[0]; - - switch (rt1015->boost_mode) { + switch (boost_mode) { case BYPASS: snd_soc_component_update_bits(component, RT1015_SMART_BST_CTRL1, RT1015_ABST_AUTO_EN_MASK | @@ -471,8 +470,11 @@ static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol, break; default: dev_err(component->dev, "Unknown boost control.\n"); + return -EINVAL; } + rt1015->boost_mode = boost_mode; + return 0; } |