[PATCH 4/4] ASoC: SOF: topology: check errors when parsing LED tokens

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux