From: Griffin Kroah-Hartman <griffin@kroah.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Cc: Griffin Kroah-Hartman <griffin@kroah.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Subject: [PATCH] soc: mediatek: mtk-socinfo Add error handling in devm_kasprintf()
Date: Thu, 9 Jul 2026 15:24:16 +0200 [thread overview]
Message-ID: <20260709132416.212212-1-griffin@kroah.com> (raw)
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>
---
drivers/soc/mediatek/mtk-socinfo.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-socinfo.c b/drivers/soc/mediatek/mtk-socinfo.c
index 424a1eb82c20..e294730ba709 100644
--- a/drivers/soc/mediatek/mtk-socinfo.c
+++ b/drivers/soc/mediatek/mtk-socinfo.c
@@ -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;
/*
--
2.55.0
next reply other threads:[~2026-07-09 13:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 13:24 Griffin Kroah-Hartman [this message]
2026-07-09 13:46 ` [PATCH] soc: mediatek: mtk-socinfo Add error handling in devm_kasprintf() AngeloGioacchino Del Regno
2026-07-09 13:50 ` AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260709132416.212212-1-griffin@kroah.com \
--to=griffin@kroah.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox