Commit 8a3ab38c authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: SOF: topology: check errors when parsing LED tokens

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: 5d43001a ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191011164312.7988-5-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 494e8f65
...@@ -963,6 +963,11 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, ...@@ -963,6 +963,11 @@ static int sof_control_load_volume(struct snd_soc_component *scomp,
ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens,
ARRAY_SIZE(led_tokens), mc->priv.array, ARRAY_SIZE(led_tokens), mc->priv.array,
le32_to_cpu(mc->priv.size)); 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", dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n",
scontrol->comp_id, scontrol->num_channels); scontrol->comp_id, scontrol->num_channels);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment