linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pm@vger.kernel.org
Subject: [PATCH 1/2] cpufreq: imx: fix regulator_get error handling
Date: Sun, 18 Oct 2015 13:01:48 +0200	[thread overview]
Message-ID: <56237C1C.80109@gmail.com> (raw)

With CONFIG_DELAY_DEVICE_PROBES being set I get the following error:

cpu cpu0: failed to get regulators
imx6q-cpufreq: probe of imx6q-cpufreq.0 failed with error -2

Fix the error handling of regulator_get to properly deal
with -EPROBE_DEFER.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/cpufreq/imx6q-cpufreq.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 380a90d..0bb33dc 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -187,11 +187,20 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 	}
 
 	arm_reg = regulator_get(cpu_dev, "arm");
+	if (IS_ERR(arm_reg)) {
+		ret = PTR_ERR(arm_reg);
+		if (ret != -EPROBE_DEFER)
+			dev_err(cpu_dev, "failed to get regulator arm\n");
+		goto put_reg;
+	}
+
 	pu_reg = regulator_get_optional(cpu_dev, "pu");
+
 	soc_reg = regulator_get(cpu_dev, "soc");
-	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
-		dev_err(cpu_dev, "failed to get regulators\n");
-		ret = -ENOENT;
+	if (IS_ERR(soc_reg)) {
+		ret = PTR_ERR(soc_reg);
+		if (ret != -EPROBE_DEFER)
+			dev_err(cpu_dev, "failed to get regulator soc\n");
 		goto put_reg;
 	}
 
-- 
2.6.1


             reply	other threads:[~2015-10-18 11:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-18 11:01 Heiner Kallweit [this message]
2015-10-18 15:55 ` [PATCH 1/2] cpufreq: imx: fix regulator_get error handling Viresh Kumar
2015-10-18 16:40   ` Heiner Kallweit
2015-10-18 16:46 ` Viresh Kumar

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=56237C1C.80109@gmail.com \
    --to=hkallweit1@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).