Richard Fitzgerald fabab199b1 ASoC: wm_adsp: Don't overwrite fwf_name with the default
[ Upstream commit daf3f0f99cde93a066240462b7a87cdfeedc04c0 ]

There's no need to overwrite fwf_name with a kstrdup() of the cs_dsp part
name. It is trivial to select either fwf_name or cs_dsp.part as the string
to use when building the filename in wm_adsp_request_firmware_file().

This leaves fwf_name entirely owned by the codec driver.

It also avoids problems with freeing the pointer. With the original code
fwf_name was either a pointer owned by the codec driver, or a kstrdup()
created by wm_adsp. This meant wm_adsp must free it if it set it, but not
if the codec driver set it. The code was handling this by using
devm_kstrdup().
But there is no absolute requirement that wm_adsp_common_init() must be
called from probe(), so this was a pseudo-memory leak - each new call to
wm_adsp_common_init() would allocate another block of memory but these
would only be freed if the owning codec driver was removed.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240129162737.497-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-01 13:34:52 +01:00
..
2021-04-20 17:25:51 +01:00
2023-08-14 13:10:36 +01:00
2024-01-20 11:51:44 +01:00
2024-01-20 11:51:44 +01:00
2023-05-25 10:54:21 +01:00
2023-07-23 23:33:05 +01:00
2023-08-11 21:12:45 +02:00
2021-03-31 18:00:38 +01:00
2023-01-31 11:04:55 +00:00
2022-06-06 12:33:10 +01:00
2023-08-10 00:19:02 +01:00
2023-08-13 19:38:00 +01:00
2023-08-13 19:37:49 +01:00
2023-08-13 19:37:50 +01:00
2023-08-13 19:37:52 +01:00
2020-05-07 13:18:04 +01:00
2023-08-13 19:37:52 +01:00
2022-10-13 13:01:32 +01:00
2023-08-13 19:37:53 +01:00
2023-08-17 22:38:42 +01:00
2023-08-13 19:37:54 +01:00
2023-08-13 19:37:56 +01:00
2023-08-13 19:37:58 +01:00
2021-12-06 10:04:05 +01:00
2022-07-08 11:52:42 +01:00
2021-12-06 10:04:05 +01:00
2020-07-20 15:34:29 +01:00
2020-10-02 21:05:29 +01:00