Skip to content

Commit

Permalink
ASoC: topology: avoid uninitialized kcontrol_type
Browse files Browse the repository at this point in the history
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 <arnd@arndb.de>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Arnd Bergmann authored and Mark Brown committed Dec 12, 2016
1 parent eea3dd4 commit dd5abb7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sound/soc/soc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
tplg->pos +=
(sizeof(struct snd_soc_tplg_dapm_widget) + w->priv.size);
if (w->num_kcontrols == 0) {
kcontrol_type = 0;
template.num_kcontrols = 0;
goto widget;
}
Expand Down

0 comments on commit dd5abb7

Please sign in to comment.