From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: James Clark <james.clark@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
linux-arm-kernel@lists.infradead.org
Cc: Mike Leach <mike.leach@linaro.org>,
coresight@lists.linaro.org, linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] coresight: etm4x: Ensure valid drvdata and clock before clk_put()
Date: Fri, 11 Aug 2023 10:09:43 +0100 [thread overview]
Message-ID: <72960b11-9e35-a259-3ea6-bae91ff94838@arm.com> (raw)
In-Reply-To: <07b0dabb-5409-9ba8-543f-aeecafe083e9@arm.com>
On 11/08/2023 09:39, James Clark wrote:
>
>
> On 11/08/2023 07:27, Anshuman Khandual wrote:
>> This validates 'drvdata' and 'drvdata->pclk' clock before calling clk_put()
>> in etm4_remove_platform_dev(). The problem was detected using Smatch static
>> checker as reported.
>>
>> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
>> Cc: Mike Leach <mike.leach@linaro.org>
>> Cc: James Clark <james.clark@arm.com>
>> Cc: coresight@lists.linaro.org
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>> Closes: https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/G4N6P4OXELPLLQSNU3GU2MR4LOLRXRMJ/
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> This applies on coresight-next
>>
>> drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> index 703b6fcbb6a5..eb412ce302cc 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> @@ -2269,7 +2269,7 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev)
>> etm4_remove_dev(drvdata);
>> pm_runtime_disable(&pdev->dev);
>>
>> - if (drvdata->pclk)
>> + if (drvdata && drvdata->pclk && !IS_ERR(drvdata->pclk))
>> clk_put(drvdata->pclk);
>>
>> return 0;
>
> It could be !IS_ERR_OR_NULL(drvdata->pclk), but I wouldn't bother
> changing it at this point.
+1, please could we have that. Someone else will run a code scanner and
send a patch later. Given this is straight and easy change, lets do it
in the first place.
Cheers
Suzuki
>
> Reviewed-by: James Clark <james.clark@arm.com>
next prev parent reply other threads:[~2023-08-11 9:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 6:27 Anshuman Khandual
2023-08-11 8:39 ` James Clark
2023-08-11 9:09 ` Suzuki K Poulose [this message]
2023-08-11 9:22 ` Anshuman Khandual
2023-08-11 10:14 ` James Clark
2023-08-16 8:06 ` Anshuman Khandual
2023-08-11 9:26 ` Dan Carpenter
2023-08-11 8:48 ` Mike Leach
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=72960b11-9e35-a259-3ea6-bae91ff94838@arm.com \
--to=suzuki.poulose@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=coresight@lists.linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=james.clark@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
/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®