[alsa-devel] [PATCH 4/4] ASoC: SOF: topology: check errors when parsing LED tokens
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Fri Oct 11 18:43:12 CEST 2019
sof_parse_tokens() returns a value that is checked on every call
except for LED tokens, fix with explicit test.
Detected with cppcheck warning:
sound/soc/sof/topology.c:973:6: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens,
^
Fixes: 5d43001ae4360 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
sound/soc/sof/topology.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 05eec3c464a9..cc138ac6a8eb 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -973,6 +973,11 @@ static int sof_control_load_volume(struct snd_soc_component *scomp,
ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens,
ARRAY_SIZE(led_tokens), mc->priv.array,
le32_to_cpu(mc->priv.size));
+ if (ret != 0) {
+ dev_err(sdev->dev, "error: parse led tokens failed %d\n",
+ le32_to_cpu(mc->priv.size));
+ return ret;
+ }
dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n",
scontrol->comp_id, scontrol->num_channels);
--
2.20.1
More information about the Alsa-devel
mailing list