soc: mediatek: mtk-socinfo Add error handling in devm_kasprintf()

Add an error check to the devm_kasprintf() function in
mtk_socinfo_create_socinfo_node(), returning -ENOMEM if the function
failed.

Assisted-by: gkh_clanker_t1000
CC: Matthias Brugger <matthias.bgg@gmail.com>
CC: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
This commit is contained in:
Griffin Kroah-Hartman
2026-07-09 15:24:16 +02:00
committed by AngeloGioacchino Del Regno
parent dc59e4fea9
commit e4a3c99bbf

View File

@@ -76,11 +76,14 @@ static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo *mtk_socinfop)
if (!attrs)
return -ENOMEM;
if (data->marketing_name != NULL && data->marketing_name[0] != '\0')
if (data->marketing_name != NULL && data->marketing_name[0] != '\0') {
attrs->family = devm_kasprintf(mtk_socinfop->dev, GFP_KERNEL, "MediaTek %s",
data->marketing_name);
else
if (!attrs->family)
return -ENOMEM;
} else {
attrs->family = soc_manufacturer;
}
attrs->soc_id = data->soc_name;
/*