ASoC: codecs: rt715: simplify set_stream
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 24 Mar 2023 01:44:06 +0000 (09:44 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 29 Mar 2023 14:03:08 +0000 (15:03 +0100)
commite506b2bd1d2e9daaedd1db2ef9868f7b8c4c86c3
treead208fe6f6501121bc63b39a35f7f0ba3bf6d5cc
parent278432084b093f7257cf96c75bb33f155e4a8232
ASoC: codecs: rt715: simplify set_stream

Using a dynamic allocation to store a single pointer is not very
efficient/useful.

Worse, the memory is released in the SoundWire stream.c file, but
still accessed in the DAI shutdown, leading to kmemleak reports.

And last the API requires the previous stream information to be
cleared when the argument is NULL.

Simplify the code to address all 3 problems.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230324014408.1677505-12-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt715.c
sound/soc/codecs/rt715.h