From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
<coresight@lists.linaro.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] coresight: trbe: Fix return value check in arm_trbe_register_coresight_cpu()
Date: Mon, 21 Oct 2024 11:57:55 +0800 [thread overview]
Message-ID: <361f5e4b-e269-1a07-ccde-017ef713eaa1@huawei.com> (raw)
In-Reply-To: <431e46b5-24f7-41f4-b321-70a6894c3831@arm.com>
On 2024/10/21 10:58, Anshuman Khandual wrote:
>
>
> On 10/18/24 19:38, Zhen Lei wrote:
>> Function devm_kzalloc() returns NULL instead of ERR_PTR() when it fails.
>
> Right, devm_kzalloc() calls devm_kmalloc() with additional __GFP_ZERO which
> returns NULL on error.
>
>> The IS_ERR() test in the return value check should be replaced with NULL
>> test.
>>
>> Fixes: 39744738a67d ("coresight: trbe: Allocate platform data per device")
>> Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
>
> Actually this problem is caused by the following commit which had replaced
> coresight_get_platform_data() with devm_kzalloc() for a dummy 'desc.pdata'
> allocation. Earlier IS_ERR() test for the return value, was correct for
> coresight_get_platform_data() which returns ERR_PTR() on error, but then
> it should have been changed for devm_kzalloc() into a NULL check instead.
>
> 4277f035d227 ("coresight: trbe: Add a representative coresight_platform_data for TRBE")
>
> Please add "Fixes:" tag for the above commit instead.
Yes, you're right. In retrospect, I probably found 3fbf7f011f24 just by
searching for IS_ERR(). I will update and post v2. Thanks.
>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.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 96a32b213669940..93fe9860acf16bd 100644
>> --- a/drivers/hwtracing/coresight/coresight-trbe.c
>> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
>> @@ -1266,7 +1266,7 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
>> * 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;
>
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
>
> .
>
--
Regards,
Zhen Lei
prev parent reply other threads:[~2024-10-21 3:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 14:08 Zhen Lei
2024-10-18 16:02 ` James Clark
2024-10-18 16:26 ` [PATCH] " Markus Elfring
2024-10-21 2:58 ` [PATCH 1/1] " Anshuman Khandual
2024-10-21 3:57 ` Leizhen (ThunderTown) [this message]
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=361f5e4b-e269-1a07-ccde-017ef713eaa1@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--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
all inboxes | Powered by JetHome®