mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: m.purski@samsung.com, p.paillet@st.com,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH] regulator: core: fix _regulator_do_disable return value
Date: Fri, 13 Jul 2018 14:56:24 +0200	[thread overview]
Message-ID: <20180713125624.13783-1-m.felsch@pengutronix.de> (raw)

Currently _regulator_do_disable returns 0 if either the ena_pin nor the
ops.disbale() isn't present. This assumes that the call was successful
but it wasn't because disbaling isn't supported at all.

The last case of the if-chain should return -EINVAL, because disabling
isn't supported by the driver as it is done already by
_regulator_do_enable.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/regulator/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index bb1324f93143..69b4e096b632 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2311,6 +2311,8 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
 		ret = rdev->desc->ops->disable(rdev);
 		if (ret != 0)
 			return ret;
+	} else {
+		return -EINVAL;
 	}
 
 	/* cares about last_off_jiffy only if off_on_delay is required by
-- 
2.18.0


             reply	other threads:[~2018-07-13 12:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 12:56 Marco Felsch [this message]
2018-07-13 13:07 ` Mark Brown
2018-07-13 15:48   ` Marco Felsch
2018-07-13 16:15     ` 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=20180713125624.13783-1-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.purski@samsung.com \
    --cc=p.paillet@st.com \
    /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

all inboxes | Powered by JetHome®