Skip to content

Commit dd5abb7

Browse files
arndbbroonie
authored andcommitted
ASoC: topology: avoid uninitialized kcontrol_type
When num_kcontrols is zero, widget->dobj.widget.kcontrol_type gets set to an uninitialized local variable: sound/soc/soc-topology.c: In function 'soc_tplg_dapm_widget_create': sound/soc/soc-topology.c:1566:36: error: 'kcontrol_type' may be used uninitialized in this function [-Werror=maybe-uninitialized] I could not figure out which of the valid types would be appropriate here, so this sets it to '0', which is invalid but at least well-defined here. There is probably a better way to address the issue. Fixes: eea3dd4 ("ASoC: topology: Only free TLV for volume mixers of a widget") Signed-off-by: Arnd Bergmann <[email protected]> Reported-by: Dan Carpenter <[email protected]> Reviewed-by: Takashi Sakamoto <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent eea3dd4 commit dd5abb7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sound/soc/soc-topology.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
14851485
tplg->pos +=
14861486
(sizeof(struct snd_soc_tplg_dapm_widget) + w->priv.size);
14871487
if (w->num_kcontrols == 0) {
1488+
kcontrol_type = 0;
14881489
template.num_kcontrols = 0;
14891490
goto widget;
14901491
}

0 commit comments

Comments
 (0)