ASoC: Intel: skl_hda_dsp_generic: Allocate snd_soc_card dynamically
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fri, 26 Apr 2024 15:21:12 +0000 (10:21 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 29 Apr 2024 15:09:58 +0000 (00:09 +0900)
commit33e59e50ee7610473c85030edca73ad3df60b5c1
tree5becedaba1fdeb4ad97e0903272ddf5db3ec4f28
parent466c8c46b4ba763435b2a787b7824d9f0fd3e76e
ASoC: Intel: skl_hda_dsp_generic: Allocate snd_soc_card dynamically

The static hda_soc_card might be modified during runtime which might cause
issues on next time when the card is created.
For example if the dmic_num was set with module parameter then removed for
the next module loading then the card's components will still going to
point to the previous boot's cfg-dmics:X string.

There might be other places where devm allocated memory have been freed but
the hda_soc_card still pointing to the now unallocated memory (the memory
is freed when the platform device is removed).

Fix this issue by moving the snd_soc_card into skl_hda_private and use it
for the card registration to ensure that it is correctly initialized every
time.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240426152123.36284-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/skl_hda_dsp_common.h
sound/soc/intel/boards/skl_hda_dsp_generic.c