From: Maxime Ripard Date: Wed, 10 Jan 2018 15:59:41 +0000 (+0100) Subject: drm/panel: lvds: Handle the optional regulator case properly X-Git-Tag: v4.16-rc1~96^2~2^2~1 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=a0d605372a279d71abd29ed985b9a51e66e12170;p=linux.git drm/panel: lvds: Handle the optional regulator case properly 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. Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart Fixes: a1c55bccf600 ("drm/panel: lvds: Add support for the power-supply property") Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20180110155941.16109-1-maxime.ripard@free-electrons.com --- diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 57e38a9e7ab4..b5e3994f0aa8 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -215,8 +215,15 @@ 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) { + if (ret != -EPROBE_DEFER) + dev_err(lvds->dev, "failed to request regulator: %d\n", + ret); + return ret; + } + + lvds->supply = NULL; } /* Get GPIOs and backlight controller. */