Skip to content

Commit c04efbf

Browse files
Chen Nibroonie
authored andcommitted
ASoC: hdaudio.c: Add missing check for devm_kstrdup
Because of the potential failure of the devm_kstrdup(), the dl[i].codecs->name could be NULL. Therefore, we need to check it and return -ENOMEM in order to transfer the error. Fixes: 97030a4 ("ASoC: Intel: avs: Add HDAudio machine board") Signed-off-by: Chen Ni <[email protected]> Reviewed-by: Amadeusz Sławiński <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent bb0216d commit c04efbf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/soc/intel/avs/boards/hdaudio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int
5555
return -ENOMEM;
5656

5757
dl[i].codecs->name = devm_kstrdup(dev, cname, GFP_KERNEL);
58+
if (!dl[i].codecs->name)
59+
return -ENOMEM;
60+
5861
dl[i].codecs->dai_name = pcm->name;
5962
dl[i].num_codecs = 1;
6063
dl[i].num_cpus = 1;

0 commit comments

Comments
 (0)