linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector
Date: Mon,  6 Oct 2014 21:33:37 +0200	[thread overview]
Message-ID: <1412624017-28673-2-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1412624017-28673-1-git-send-email-mpa@pengutronix.de>

A '0' voltage selector is invalid and can't be used with this driver.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/regulator/anatop-regulator.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 30e8d7ad5813..542d14ed48bb 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -291,6 +291,11 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 		 */
 		if (!sreg->sel && !strcmp(sreg->name, "vddpu"))
 			sreg->sel = 22;
+
+		if (!sreg->sel) {
+			dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
+			return -EINVAL;
+		}
 	} else {
 		rdesc->ops = &anatop_rops;
 	}
-- 
2.1.0

  reply	other threads:[~2014-10-06 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 19:33 [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Markus Pargmann
2014-10-06 19:33 ` Markus Pargmann [this message]
2014-10-07 11:52   ` [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector Mark Brown
2014-10-07 11:51 ` [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Mark Brown

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=1412624017-28673-2-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).