[PATCH] drm/panel: lvds: Handle the optional regulator case properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux