mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Qiang Yu <yuq825@gmail.com>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH] drm/lima: Fix regulator_get_optional() misuse
Date: Wed,  4 Sep 2019 13:31:29 +0100	[thread overview]
Message-ID: <20190904123129.23351-1-broonie@kernel.org> (raw)

The lima driver requests a supply using regulator_get_optional() but
both the name of the supply and the usage pattern suggest that it is
being used for the main power for the device and is not at all optional
for the device for function, there is no meaningful handling for absent
supplies.  Such regulators should use the vanilla regulator_get()
interface, it will ensure that even if a supply is not described in the
system integration one will be provided in software.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/gpu/drm/lima/lima_device.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c
index d86b8d81a483..d718ac70df1e 100644
--- a/drivers/gpu/drm/lima/lima_device.c
+++ b/drivers/gpu/drm/lima/lima_device.c
@@ -142,12 +142,9 @@ static int lima_regulator_init(struct lima_device *dev)
 {
 	int ret;
 
-	dev->regulator = devm_regulator_get_optional(dev->dev, "mali");
+	dev->regulator = devm_regulator_get(dev->dev, "mali");
 	if (IS_ERR(dev->regulator)) {
 		ret = PTR_ERR(dev->regulator);
-		dev->regulator = NULL;
-		if (ret == -ENODEV)
-			return 0;
 		if (ret != -EPROBE_DEFER)
 			dev_err(dev->dev, "failed to get regulator: %d\n", ret);
 		return ret;
@@ -164,8 +161,7 @@ static int lima_regulator_init(struct lima_device *dev)
 
 static void lima_regulator_fini(struct lima_device *dev)
 {
-	if (dev->regulator)
-		regulator_disable(dev->regulator);
+	regulator_disable(dev->regulator);
 }
 
 static int lima_init_ip(struct lima_device *dev, int index)
-- 
2.20.1


                 reply	other threads:[~2019-09-04 12:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190904123129.23351-1-broonie@kernel.org \
    --to=broonie@kernel.org \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuq825@gmail.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®