From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Daniel Vetter <daniel.vetter@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Sean Paul <seanpaul@chromium.org>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: [PATCH] drm/panel: lvds: Handle the optional regulator case properly
Date: Wed, 10 Jan 2018 16:59:41 +0100 [thread overview]
Message-ID: <20180110155941.16109-1-maxime.ripard@free-electrons.com> (raw)
The devm_regulator_get_optional function, unlike it was assumed in the
commit a1c55bccf600 ("drm/panel: lvds: Add support for the power-supply
property"), is actually returning an error pointer with -ENODEV instead of
NULL when there's no regulator to find.
Make sure we handle that case properly.
Fixes: a1c55bccf600 ("drm/panel: lvds: Add support for the power-supply property")
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/gpu/drm/panel/panel-lvds.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 57e38a9e7ab4..9f46e7095c0e 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -215,8 +215,13 @@ static int panel_lvds_probe(struct platform_device *pdev)
lvds->supply = devm_regulator_get_optional(lvds->dev, "power");
if (IS_ERR(lvds->supply)) {
ret = PTR_ERR(lvds->supply);
- dev_err(lvds->dev, "failed to request regulator: %d\n", ret);
- return ret;
+
+ if (ret != -ENODEV) {
+ dev_err(lvds->dev, "failed to request regulator: %d\n", ret);
+ return ret;
+ } else {
+ lvds->supply = NULL;
+ }
}
/* Get GPIOs and backlight controller. */
--
2.14.3
next reply other threads:[~2018-01-10 16:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 15:59 Maxime Ripard [this message]
2018-01-11 13:05 ` Laurent Pinchart
2018-01-11 13:12 ` Maxime Ripard
2018-01-11 22:06 ` Laurent Pinchart
2018-01-11 22:09 ` Laurent Pinchart
2018-01-15 9:18 ` Maxime Ripard
2018-01-11 14:31 ` Jani Nikula
2018-01-11 21:30 ` Laurent Pinchart
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=20180110155941.16109-1-maxime.ripard@free-electrons.com \
--to=maxime.ripard@free-electrons.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seanpaul@chromium.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
all inboxes | Powered by JetHome®