public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panel: lvds: Handle the optional regulator case properly
@ 2018-01-10 15:59 Maxime Ripard
  2018-01-11 13:05 ` Laurent Pinchart
  0 siblings, 1 reply; 8+ messages in thread
From: Maxime Ripard @ 2018-01-10 15:59 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, Sean Paul
  Cc: dri-devel, linux-kernel, Laurent Pinchart, Maxime Ripard

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-15  9:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 15:59 [PATCH] drm/panel: lvds: Handle the optional regulator case properly Maxime Ripard
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox