All of lore.kernel.org
 help / color / mirror / Atom feed
From: quanyang.wang@windriver.com
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Quanyang Wang <quanyang.wang@windriver.com>
Subject: [V2][PATCH] cpufreq: dt: check the -EPROBE_DEFER error returned by dev_pm_opp_of_cpumask_add_table
Date: Thu, 25 Mar 2021 14:42:08 +0800	[thread overview]
Message-ID: <20210325064208.2291413-1-quanyang.wang@windriver.com> (raw)

From: Quanyang Wang <quanyang.wang@windriver.com>

The function dev_pm_opp_of_cpumask_add_table may return -EPROBE_DEFER
which comes from clk_get(dev, NULL) in _update_opp_table_clk. Ignoring
this error and call the next function  dev_pm_opp_of_cpumask_add_table
may cause dt_cpufreq_probe return -ENODEV instead of -EPROBE_DEFER.
And this will result cpufreq-dt driver probe failure.

Add check condition to fix this issue.

Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
---
 drivers/cpufreq/cpufreq-dt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index b1e1bdc63b01..25e46df92941 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -257,7 +257,12 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
 	 *
 	 * OPPs might be populated at runtime, don't check for error here.
 	 */
-	if (!dev_pm_opp_of_cpumask_add_table(priv->cpus))
+	ret = dev_pm_opp_of_cpumask_add_table(priv->cpus);
+	if (ret) {
+		/* Return the -EPROBE_DEFER error to trigger the deferred probe. */
+		if (ret == -EPROBE_DEFER)
+			goto out;
+	} else
 		priv->have_static_opps = true;
 
 	/*
-- 
2.25.1


             reply	other threads:[~2021-03-25  6:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  6:42 quanyang.wang [this message]
2021-03-25  7:12 ` [V2][PATCH] cpufreq: dt: check the -EPROBE_DEFER error returned by dev_pm_opp_of_cpumask_add_table Viresh Kumar
  -- strict thread matches above, loose matches on Subject: below --
2021-03-25  6:41 quanyang.wang

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=20210325064208.2291413-1-quanyang.wang@windriver.com \
    --to=quanyang.wang@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@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 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.