ASoC: codecs: fs210x: Add NULL check in fs210x_register_snd_component

Add check for the return value of devm_kmemdup() to prevent
potential null pointer dereference.

Fixes: 7561177017 ("ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Message-ID: <20250905091845.1559-1-hanchunchao@inspur.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Han 2025-09-05 17:18:44 +08:00 committed by Mark Brown
parent 554f6006c3
commit be585f7ebc
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1458,6 +1458,9 @@ static int fs210x_register_snd_component(struct fs210x_priv *fs210x)
dai_drv->name = devm_kasprintf(fs210x->dev,
GFP_KERNEL, "%s-%d",
dai_drv->name, instance_id);
if (!dai_drv->name)
return -ENOMEM;
instance_id++;
if (fs210x->devid == FS2105S_DEVICE_ID) {