public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Alexander Stein <alexander.stein@ew.tq-group.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: <shawnguo@kernel.org>, <s.hauer@pengutronix.de>,
	<kernel@pengutronix.de>, <festevam@gmail.com>,
	<linux-imx@nxp.com>, <xiaolei.wang@windriver.com>,
	<l.stach@pengutronix.de>
Subject: Re: [PATCH] soc: imx8m: fix wrong return value check of of_clk_get_by_name()
Date: Wed, 4 Jan 2023 16:03:17 +0800	[thread overview]
Message-ID: <82ddb754-a0e5-efaf-6654-70a795ab8b81@huawei.com> (raw)
In-Reply-To: <1882509.eGJsNajkDb@steina-w>


On 2023/1/4 15:50, Alexander Stein wrote:
> Hi,
>
> Am Mittwoch, 4. Januar 2023, 07:41:36 CET schrieb Yang Yingliang:
>> of_clk_get_by_name() never returns NULL pointer, it will return
>> ERR_PTR() when it fails, so replace the check with IS_ERR().
>>
>> Fixes: 836fb30949d9 ("soc: imx8m: Enable OCOTP clock before reading the
>> register") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/soc/imx/soc-imx8m.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
>> index 28144c699b0c..32ed9dc88e45 100644
>> --- a/drivers/soc/imx/soc-imx8m.c
>> +++ b/drivers/soc/imx/soc-imx8m.c
>> @@ -66,8 +66,8 @@ static u32 __init imx8mq_soc_revision(void)
>>   	ocotp_base = of_iomap(np, 0);
>>   	WARN_ON(!ocotp_base);
>>   	clk = of_clk_get_by_name(np, NULL);
>> -	if (!clk) {
>> -		WARN_ON(!clk);
>> +	if (IS_ERR(clk)) {
> Nice catch. But wouldn't
>> if (WARN_ON(IS_ERR(clk)))
> be even better instead of doing the check twice?
Yes, it's better, I will send a new version.

Thanks,
Yang
>
> Best regards,
> Alexander
>
>> +		WARN_ON(IS_ERR(clk));
>>   		return 0;
>>   	}
>
>
>
> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2023-01-04  8:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  6:41 [PATCH] soc: imx8m: fix wrong return value check of of_clk_get_by_name() Yang Yingliang
2023-01-04  7:50 ` Alexander Stein
2023-01-04  8:03   ` Yang Yingliang [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=82ddb754-a0e5-efaf-6654-70a795ab8b81@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=xiaolei.wang@windriver.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