* [PATCH] ASoC: rt5663: refine error handling
@ 2016-09-15 15:42 Arnd Bergmann
2016-09-16 17:38 ` Applied "ASoC: rt5663: refine error handling" to the asoc tree Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-09-15 15:42 UTC (permalink / raw)
To: Mark Brown
Cc: Arnd Bergmann, Bard Liao, Oder Chiou, Liam Girdwood, John Lin,
Jack Yu, alsa-devel, linux-kernel
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")
---
sound/soc/codecs/rt5663.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index 7963a2736a91..8078abcaf728 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 |
--
2.9.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Applied "ASoC: rt5663: refine error handling" to the asoc tree
2016-09-15 15:42 [PATCH] ASoC: rt5663: refine error handling Arnd Bergmann
@ 2016-09-16 17:38 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2016-09-16 17:38 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Mark Brown, Mark Brown, Oder Chiou, Jack Yu, alsa-devel,
linux-kernel, Liam Girdwood, John Lin, Bard Liao
The patch
ASoC: rt5663: refine error handling
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 56efaed524dc2c3571f66d296cb1efbd59cb2996 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 15 Sep 2016 17:42:21 +0200
Subject: [PATCH] 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>
---
sound/soc/codecs/rt5663.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index 7963a2736a91..8078abcaf728 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 |
--
2.8.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-16 17:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 15:42 [PATCH] ASoC: rt5663: refine error handling Arnd Bergmann
2016-09-16 17:38 ` Applied "ASoC: rt5663: refine error handling" to the asoc tree Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®