From patchwork Wed Jan 10 15:59:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10155369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF3A760223 for ; Wed, 10 Jan 2018 15:59:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0A221FF22 for ; Wed, 10 Jan 2018 15:59:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5314204FA; Wed, 10 Jan 2018 15:59:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5674A1FF22 for ; Wed, 10 Jan 2018 15:59:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0254389FC9; Wed, 10 Jan 2018 15:59:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id CB18889FC9 for ; Wed, 10 Jan 2018 15:59:43 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 9514720846; Wed, 10 Jan 2018 16:59:42 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 6AA93204AE; Wed, 10 Jan 2018 16:59:42 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH] drm/panel: lvds: Handle the optional regulator case properly Date: Wed, 10 Jan 2018 16:59:41 +0100 Message-Id: <20180110155941.16109-1-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 Cc: Maxime Ripard , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart --- 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. */