All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Chanwoo Choi <cwchoi00@gmail.com>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>
Subject: Re: [PATCH v1 4/4] PM / devfreq: tegra30: Check whether clk_round_rate() returns zero rate
Date: Thu, 16 Sep 2021 04:28:07 +0300	[thread overview]
Message-ID: <26d90b01-13d5-3bd8-da0a-b9ff61c7845a@gmail.com> (raw)
In-Reply-To: <e9233eeb-6780-b390-dffa-8de9315effa3@gmail.com>

15.09.2021 21:31, Chanwoo Choi пишет:
> On 21. 9. 15. 오후 12:51, Chanwoo Choi wrote:
>> Hi,
>>
>> On 21. 9. 13. 오전 3:44, Dmitry Osipenko wrote:
>>> EMC clock is always-on and can't be zero. Check whether clk_round_rate()
>>> returns zero rate and error out if it does. It can return zero if clock
>>> tree isn't initialized properly.
>>>
>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>> ---
>>>   drivers/devfreq/tegra30-devfreq.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/devfreq/tegra30-devfreq.c
>>> b/drivers/devfreq/tegra30-devfreq.c
>>> index d83fdc2713ed..65ecf17a36f4 100644
>>> --- a/drivers/devfreq/tegra30-devfreq.c
>>> +++ b/drivers/devfreq/tegra30-devfreq.c
>>> @@ -891,9 +891,9 @@ static int tegra_devfreq_probe(struct
>>> platform_device *pdev)
>>>           return err;
>>>       rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
>>> -    if (rate < 0) {
>>> +    if (rate <= 0) {
>>>           dev_err(&pdev->dev, "Failed to round clock rate: %ld\n",
>>> rate);
>>> -        return rate;
>>> +        return rate ?: -EINVAL;
> 
> If rate is 0, It doesn't return and fall-through? even if print the
> error message. 'return rate ?: -EINVAL;' style is strange for me
> because it doesn't specify the 'return value' when rate is true.

It's not clear to me what do you mean by "return and fall-through".

It specifies the 'return value' when rate is true. It's a short form of
"rate ? rate : -EINVAL".

The final returned value will be printed by the driver's core. The value
returned by clk_round_rate() is important here since it tells the reason
of the error.

https://elixir.bootlin.com/linux/v5.15-rc1/source/drivers/base/dd.c#L533

  reply	other threads:[~2021-09-16  1:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12 18:44 [PATCH v1 0/4] Make probe() of Tegra devfreq driver completely resource-managed Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 1/4] opp: Add more resource-managed variants of dev_pm_opp_of_add_table() Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 2/4] PM / devfreq: Add devm_devfreq_add_governor() Dmitry Osipenko
2021-09-15 18:23   ` Chanwoo Choi
2021-09-16  1:30     ` Dmitry Osipenko
2021-09-15 18:37   ` Chanwoo Choi
2021-09-16  1:29     ` Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 3/4] PM / devfreq: tegra30: Use resource-managed helpers Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 4/4] PM / devfreq: tegra30: Check whether clk_round_rate() returns zero rate Dmitry Osipenko
2021-09-15  3:51   ` Chanwoo Choi
2021-09-15 18:31     ` Chanwoo Choi
2021-09-16  1:28       ` Dmitry Osipenko [this message]
2021-09-19  9:43         ` Chanwoo Choi

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=26d90b01-13d5-3bd8-da0a-b9ff61c7845a@gmail.com \
    --to=digetx@gmail.com \
    --cc=cw00.choi@samsung.com \
    --cc=cwchoi00@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=nm@ti.com \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vireshk@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.