From: James Clark <james.clark@linaro.org>
To: Lin Yujun <linyujun809@h-partners.com>, suzuki.poulose@arm.com
Cc: linux-kernel@vger.kernel.org,
"coresight@lists.linaro.org" <coresight@lists.linaro.org>,
mike.leach@linaro.org, alexander.shishkin@linux.intel.com,
anshuman.khandual@arm.com, Leo Yan <leo.yan@arm.com>
Subject: Re: [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc
Date: Mon, 8 Sep 2025 13:38:26 +0100 [thread overview]
Message-ID: <fa9d3b0e-71d9-4fa9-8522-185ebdddcf00@linaro.org> (raw)
In-Reply-To: <20250908122022.1315399-1-linyujun809@h-partners.com>
On 08/09/2025 1:20 pm, Lin Yujun wrote:
> The return value of devm_kzalloc could be an null pointer,
> use "!desc.pdata" to fix incorrect handling return value
> of devm_kzalloc.
>
> Fixes: 4277f035d227 ("coresight: trbe: Add a representative coresight_platform_data for TRBE")
> Signed-off-by: Lin Yujun <linyujun809@h-partners.com>
> ---
> drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 8267dd1a2130..caf873adfc3a 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -1277,11 +1277,11 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
> * ends up failing. Instead let's allocate a dummy zeroed
> * coresight_platform_data structure and assign that back
> * into the device for that purpose.
> */
> desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL);
> - if (IS_ERR(desc.pdata))
> + if (!desc.pdata)
> goto cpu_clear;
>
> desc.type = CORESIGHT_DEV_TYPE_SINK;
> desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM;
> desc.ops = &arm_trbe_cs_ops;
Reviewed-by: James Clark <james.clark@linaro.org>
next prev parent reply other threads:[~2025-09-08 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-08 12:20 [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc Lin Yujun
2025-09-08 12:38 ` James Clark [this message]
2025-09-10 16:26 ` Suzuki K Poulose
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=fa9d3b0e-71d9-4fa9-8522-185ebdddcf00@linaro.org \
--to=james.clark@linaro.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=coresight@lists.linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linyujun809@h-partners.com \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.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