ASoC: dapm: Fix empty list check in dapm_new_mux()
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 1 Aug 2013 16:30:38 +0000 (18:30 +0200)
committerMark Brown <broonie@linaro.org>
Thu, 1 Aug 2013 18:25:16 +0000 (19:25 +0100)
commitfe581391147cb3d738d961d0f1233d91a9e1113c
treecadab7c9e8b6913e9373c6fa6ae35981385c8221
parent56a678344273fd63f8ade26876283a2586a9bf3a
ASoC: dapm: Fix empty list check in dapm_new_mux()

list_first_entry() will always return a valid pointer, even if the list is
empty. So the check whether path is NULL will always be false. So we end up
calling dapm_create_or_share_mixmux_kcontrol() with a path struct that points
right in the middle of the widget struct and by trying to modify the path the
widgets memory will become corrupted. Fix this by using list_emtpy() to check if
the widget doesn't have any paths.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
sound/soc/soc-dapm.c