Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Griffin Kroah-Hartman <griffin@kroah.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Subject: Re: [PATCH] soc: mediatek: mtk-socinfo Add error handling in devm_kasprintf()
Date: Thu, 9 Jul 2026 15:46:49 +0200	[thread overview]
Message-ID: <5b6b81d1-5492-486b-92e4-dc67457fa9d3@collabora.com> (raw)
In-Reply-To: <20260709132416.212212-1-griffin@kroah.com>

On 7/9/26 15:24, Griffin Kroah-Hartman wrote:
> 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>

Yeah, makes sense.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.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;
>   	/*


  reply	other threads:[~2026-07-09 13:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 13:24 [PATCH] soc: mediatek: mtk-socinfo Add error handling in devm_kasprintf() Griffin Kroah-Hartman
2026-07-09 13:46 ` AngeloGioacchino Del Regno [this message]
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=5b6b81d1-5492-486b-92e4-dc67457fa9d3@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=griffin@kroah.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