ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards()
Subsystems (3)
Cezary Rojewski
maintainerPATCH 1/2 ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards()
Caller is responsible for freeing array allocated with parse_int_array().
Found out by Coverity.
--- sound/soc/intel/avs/board_selection.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/intel/avs/board_selection.c +6 -3
@@ -520,7 +520,8 @@ static int avs_register_i2s_test_boards(struct avs_dev *adev)if (num_elems > max_ssps) {dev_err (adev->dev,"board supports only %d SSP, %d specified\n" , max_ssps, num_elems); -return -EINVAL ; + ret = -EINVAL ; + goto exit; }for (ssp_port =0 ; ssp_port < num_elems; ssp_port++) {
@@ -528,11 +529,13 @@ static int avs_register_i2s_test_boards(struct avs_dev *adev)for_each_set_bit (tdm_slot, &tdm_slots,16 ) { ret =avs_register_i2s_test_board (adev, ssp_port, tdm_slot);if (ret) -return ret; + goto exit; } } -return 0 ; +exit: +kfree (array); +return ret; }static int avs_register_i2s_board (struct avs_dev *adev,struct snd_soc_acpi_mach *mach)
Signature · 1 line
2.34.1
Cezary Rojewski
maintainerPATCH 2/2 ASoC: Intel: avs: Fix type warning in avs_probe_compr_set_params()
Expected argument type is snd_pcm_format_t.
Found out by sparse.
---
This is a continuation of topic "ASoC: Intel: avs: Set of streaming fixes" from last year [1]. The warning keeps popping out in the scans, time to get rid of it.
[1]: https://lore.kernel.org/linux-sound/[email protected]/
sound/soc/intel/avs/probes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/probes.c +1 -1
@@ -144,7 +144,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream, ret =snd_compr_malloc_pages (cstream, rtd->buffer_size);if (ret <0 )return ret; - bps =snd_pcm_format_physical_width (params->codec.format); + bps =snd_pcm_format_physical_width ((__force snd_pcm_format_t )params->codec.format);if (bps <0 )return bps; format_val =snd_hdac_stream_format (params->codec.ch_out, bps, params->codec.sample_rate);
Signature · 1 line
2.34.1
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: Intel: avs: Fix type warning in avs_probe_compr_set_params()
sound/soc/intel/avs/probes.c static int avs_probe_compr_set_params(struct snd_compr_stream *cstream, · line 147
Quoted 5 lines · Cezary Rojewski
Expected argument type is
snd_pcm_format_t.
Found out by sparse.sound/soc/intel/avs/probes.c +1
-1- bps =snd_pcm_format_physical_width (params->codec.format); + bps =snd_pcm_format_physical_width ((__force snd_pcm_format_t )params->codec.format);
There was an earlier patch for this one that didn't get reviewed (and every time I looked at it the __force looks super suspect):
Cezary Rojewski
maintainerRe: [PATCH 2/2] ASoC: Intel: avs: Fix type warning in avs_probe_compr_set_params()
Quoted 11 lines · Mark Brown
sound/soc/intel/avs/probes.c static int avs_probe_compr_set_params(struct snd_compr_stream *cstream, · line 147
Quoted 5 lines · Cezary Rojewski
Expected argument type is
snd_pcm_format_t.
Found out by sparse.sound/soc/intel/avs/probes.c +1
-1- bps =snd_pcm_format_physical_width (params->codec.format); + bps =snd_pcm_format_physical_width ((__force snd_pcm_format_t )params->codec.format);There was an earlier patch for this one that didn't get reviewed (and every time I looked at it the
__forcelooks super suspect):https://patch.msgid.link/[email protected]
I don't mind either version. This is basically an incremental update which I should have sent long ago. The warning keeps bothering us in the scans.
Are you suggesting we should squelch the warning instead of forcing the conversion here? The use of __force is present within include/sound/pcm_params.h, params_format().
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: Intel: avs: Fix type warning in avs_probe_compr_set_params()
Quoted 8 lines · Cezary Rojewski
On 2026-04-07 1:28 PM, Mark Brown wrote:
I don't mind either version. This is basically an incremental update which I should have sent long ago. The warning keeps bothering us in the scans.
Are you suggesting we should squelch the warning instead of forcing the conversion here? The use of
__forceis present withininclude/sound/pcm_params.h,params_format().
No, it's fine - it's ugly but whatever.
Mark Brown
maintainerRe: (subset) [PATCH 1/2] ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards()
In reply to Cezary RojewskiQuoted 1 line · Cezary Rojewski
ASoC: Intel: avs: Fix memory leak in
avs_register_i2s_test_boards()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.0
Thanks!
[1/2] ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards()
https://git.kernel.org/broonie/sound/c/c5408d818316
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark