mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
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:
committed by
AngeloGioacchino Del Regno
parent
dc59e4fea9
commit
e4a3c99bbf
@@ -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;
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user