OSDN Git Service

ASoC: SOF: topology: free kcontrol memory on error
authorDragos Tarcatu <dragos_tarcatu@mentor.com>
Mon, 11 Nov 2019 22:20:38 +0000 (16:20 -0600)
committerMark Brown <broonie@kernel.org>
Tue, 12 Nov 2019 17:12:27 +0000 (17:12 +0000)
commit1b4efdaf6d6053c8944cee0edba0969dc1be7d4b
tree1e903c0cc7e0b30fae054af99dd2a31e69c31d63
parent5e35d5f4224adb24c2bfa814b9fb562050aba3ea
ASoC: SOF: topology: free kcontrol memory on error

The volume and bytes kcontrols are currently not freeing their
memory on initialization failures. When an error occurs, all the
widgets loaded so far are unloaded via sof_widget_unload().
But this only happens for the widgets that got successfully loaded.

Fix that by kfree()-ing the allocated memory on load error.

Fixes: 311ce4fe7637d ("ASoC: SOF: Add support for loading topologies")
Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111222039.19651-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/topology.c