mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] mci: core: Do not fail if vmmc regulator fail
Date: Sat, 18 Jun 2016 16:28:57 +0300	[thread overview]
Message-ID: <1466256538-4067-3-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1466256538-4067-1-git-send-email-shc_work@mail.ru>

The vmmc regulator can be an usupported device for barebox,
the specific MFD regulator type, for example. Just lets think is all ok.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/mci-core.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 59f6675..086b564 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1585,11 +1585,13 @@ static int mci_card_probe(struct mci *mci)
 		return -ENODEV;
 	}
 
-	ret = regulator_enable(host->supply);
-	if (ret) {
-		dev_err(&mci->dev, "failed to enable regulator: %s\n",
+	if (!IS_ERR(host->supply)) {
+		ret = regulator_enable(host->supply);
+		if (ret) {
+			dev_err(&mci->dev, "failed to enable regulator: %s\n",
 				strerror(-ret));
-		return ret;
+			return ret;
+		}
 	}
 
 	/* start with a host interface reset */
@@ -1680,7 +1682,8 @@ on_error:
 	if (rc != 0) {
 		host->clock = 0;	/* disable the MCI clock */
 		mci_set_ios(mci);
-		regulator_disable(host->supply);
+		if (!IS_ERR(host->supply))
+			regulator_disable(host->supply);
 	}
 
 	return rc;
@@ -1767,10 +1770,8 @@ int mci_register(struct mci_host *host)
 	mci->dev.detect = mci_detect;
 
 	host->supply = regulator_get(host->hw_dev, "vmmc");
-	if (IS_ERR(host->supply)) {
-		ret = PTR_ERR(host->supply);
-		goto err_free;
-	}
+	if (IS_ERR(host->supply))
+		dev_err(&mci->dev, "Failed to get 'vmmc' regulator.\n");
 
 	ret = register_device(&mci->dev);
 	if (ret)
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2016-06-18 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18 13:28 [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Alexander Shiyan
2016-06-18 13:28 ` [PATCH 2/4] mci: imx: Add devicetree options parsing by MCI core Alexander Shiyan
2016-06-18 13:28 ` Alexander Shiyan [this message]
2016-06-18 13:28 ` [PATCH 4/4] mci: imx-esdhc: Remove excess function Alexander Shiyan
2016-06-20  6:32 ` [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Sascha Hauer

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=1466256538-4067-3-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.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