diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-09-15 17:42:21 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-09-16 16:47:28 +0100 |
commit | 56efaed524dc2c3571f66d296cb1efbd59cb2996 (patch) | |
tree | f46bd8cea3894281261b02a2ec6bbc87a7adf0c6 /sound | |
parent | df7c52168ee15b3951b50078c0c3960598eb0109 (diff) | |
download | op-kernel-dev-56efaed524dc2c3571f66d296cb1efbd59cb2996.zip op-kernel-dev-56efaed524dc2c3571f66d296cb1efbd59cb2996.tar.gz |
ASoC: rt5663: refine error handling
The newly added rt5663 codec driver introduces a couple of warnings
when built with -Wmaybe-uninitialized:
codecs/rt5663.c: In function 'rt5663_set_tdm_slot':
codecs/rt5663.c:2680:2: error: 'reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
codecs/rt5663.c: In function 'rt5663_set_dai_pll':
codecs/rt5663.c:2556:12: error: 'shift' may be used uninitialized in this function [-Werror=maybe-uninitialized]
codecs/rt5663.c:2596:2: error: 'mask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
We can avoid those warnings by always returning an error
from the switch() statements instead of falling through
with an uninitialized variable when we hit an unexpected
case.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: df7c52168ee1 ("ASoC: add rt5663 codec driver")
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rt5663.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 7963a27..8078abc 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -1831,6 +1831,7 @@ static int rt5663_i2s_use_asrc(struct snd_soc_dapm_widget *source, break; default: dev_err(codec->dev, "Unknown CODEC_TYPE\n"); + return 1; } if (da_asrc_en || ad_asrc_en) @@ -2579,6 +2580,7 @@ static int rt5663_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, break; default: dev_err(codec->dev, "Unknown CODEC_TYPE\n"); + return -EINVAL; } switch (source) { @@ -2674,6 +2676,7 @@ static int rt5663_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, break; default: dev_err(codec->dev, "Unknown CODEC_TYPE\n"); + return -EINVAL; } snd_soc_update_bits(codec, reg, RT5668_TDM_MODE_MASK | |