Skip to content

Commit 1afd8f0

Browse files
CassivsGabriellisbroonie
authored andcommitted
ASoC: amd: acp-sdw-legacy: check CPU DAI name before logging
devm_kasprintf() can fail and return NULL. The legacy AMD SoundWire machine driver logs cpus->dai_name before checking the allocation result. Move the debug print after the NULL check, matching the ordering used by the SOF AMD SoundWire path after commit 5726b68 ("ASoC: amd/sdw_utils: avoid NULL deref when devm_kasprintf() fails"). Fixes: 2981d9b ("ASoC: amd: acp: add soundwire machine driver for legacy stack") Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com> Link: https://patch.msgid.link/20260511-asoc-amd-acp-sdw-legacy-dai-name-null-v1-1-dc6151b6da8a@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7e68ba2 commit 1afd8f0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/soc/amd/acp/acp-sdw-legacy-mach.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ static int create_sdw_dailink(struct snd_soc_card *card,
260260
cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
261261
"SDW%d Pin%d",
262262
link_num, cpu_pin_id);
263-
dev_dbg(dev, "cpu->dai_name:%s\n", cpus->dai_name);
264263
if (!cpus->dai_name)
265264
return -ENOMEM;
265+
dev_dbg(dev, "cpu->dai_name:%s\n", cpus->dai_name);
266266

267267
codec_maps[j].cpu = 0;
268268
codec_maps[j].codec = j;

0 commit comments

Comments
 (0)