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: 124104 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5443779qgn; Wed, 10 Jan 2018 07:59:46 -0800 (PST) X-Google-Smtp-Source: ACJfBosnZ/J76oOCDbLHYV4Ddm8NRdoIAPlxQCYY11qhrKTzsZCjTSXFSBFLx7+r3av6KZFn5V/N X-Received: by 10.98.49.134 with SMTP id x128mr17126665pfx.163.1515599986829; Wed, 10 Jan 2018 07:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515599986; cv=none; d=google.com; s=arc-20160816; b=Pn7FU4SuuTptl+pG2RzRbnjAhna2q9ktobk4fGqwQKqapNJGEEBqZ8JzeYJPPAuYIC zdswGdraLPU8lWk2vvm7o9HhdaC3fmmIKTCZvvyF78RF4KA2f+HJxXEC2BBBpYCMey5R JYHp5QXDYm9HK0/aGd0p7uD05TxFkmeRlOZMv93gT/haJZdXG79L2g4FCorAyio6SYDT E2i8OcGNW1IbAP+lgGskARedXfs/U7GNjkRuY8vniWI0YtmtYmuRecCo0JbxmgPZ/XOs yWyYbLiOvzEOSGwYSnz0uHTkHjpFN6EgSKXJKruvS6sHUK7FZKfE67Roz/+w+esFoS+p LH9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=vPWzcYA2ZJQ7VZ9fKBWIdzNV36ht3kvT00DzIT3/w+g=; b=YbfNws7WIO/vvzhXBD3u4cbLkzHoW1kkQJiFBeWp07Vsuoo6iMKYvA9DKtgVhiRuIA mulCw3PcBlKvMplKoiI2atI6doep47XkFgo3OfW8DLf44LdDZTi6p320ncNpNuuOHN8k bIs6DjnmB4EAgKl30z2ixNUsJDBmxUfRgRb09KhIAELLtyiSZMG1aoedjqYYh8qdDy4w XYXLchd8paMqh/vwD/mPlF+aPQq0/w9q2Gn2pul5qzdt4Glk01ezKaAlYfH/yYRTp22Z JtbqxgBcfVKXK9KIxNkTvraD3suVzapIqu4ScTvXP3KD9uEJnaOfscPDClt7+DTC0X// Fs0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t21si5598444plj.760.2018.01.10.07.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 07:59:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org 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) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 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" 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 --- 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. */