From patchwork Tue Nov 5 12:59:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 178496 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp721729ilf; Tue, 5 Nov 2019 04:59:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxNuldApnRC5yJPxtwKzFC7tQoJtqb9tmMmnm81Lncc616wMYQRl0I0qPHS8SROgrQGRrIH X-Received: by 2002:a63:5d26:: with SMTP id r38mr16062690pgb.48.1572958792830; Tue, 05 Nov 2019 04:59:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572958792; cv=none; d=google.com; s=arc-20160816; b=tMWWEJx5LR6fKR+WyQ1NovvVHyAt3NsLnvBClgWYnm2uX1LRrPEbO61xI0InQD45ak trylM+/hR5GgqspfnBco+TTSCKG0nZ9iV8PQIfV8Jdga5ipVh+ANhdZVT0sK4Lr3eHi6 whUcnxin1WqXNoUUWsBl+qH5NlHiIkRmF8STo3x2bewt4UJQanOc3dtj5V9aCGEh9Hg2 00uQxdaF6kVobAROWzdsH3q78wNFcELjMkzLRJwIb0aHllIUqtHE5BS/Vo/HXhFxkUjQ lexCXRqKNxLlTOZbq3nkgE+Vtw610qPvTv9Wa6hxHt5rYBAwZkS9OlC6+sUnkU4hzzc8 B1oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=/z3HNlUd1JWt1JQzT/BFm2wWA0ChV3ezwyUldSSoNwk=; b=bK3vWtZBxq9wYtUvjayUdi/hkm6+S0+JaMrcr/aFkRmtr/e2Z5qLX/tTMFM7ckQCxh ek3SvobJ9hg+q+CLBAYpOYraeOTvkEJulTBWzvyOGT+2UO6OSb52W756xH7SbPCb6INJ +bPAZ4oNRqaBbrUFl+agXOZpK2DJkk/42/Z6zamhmqvN93S8Tu+SEtDsqyFu7PnmBEdm JwYUj73Xhc6x+GWBpguPOcrKmpsX1moVQmPrtsfHQRZLael4h8JSQqj2ftEzEi53fER9 WGZH1vglLWMMa1/0GK3C/ZYEdFI5U4guehxILZY9Tks4Ko22+V6egQJK62XUO0uocUH5 PlyQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id h27si3119592pgi.419.2019.11.05.04.59.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2019 04:59:52 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0149B6EA42; Tue, 5 Nov 2019 12:59:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D1086EA42 for ; Tue, 5 Nov 2019 12:59:49 +0000 (UTC) Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=ypsilon.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iRyR0-0006ao-Nv; Tue, 05 Nov 2019 12:59:46 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id D1134274301E; Tue, 5 Nov 2019 12:59:45 +0000 (GMT) From: Mark Brown To: Thierry Reding , David Airlie , Daniel Vetter , Jonathan Hunter Subject: [PATCH] drm/tegra: Fix regulator_get_optional() misuse Date: Tue, 5 Nov 2019 12:59:42 +0000 Message-Id: <20191105125943.34729-1-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iFTVrYBWldjdkzW4JZSdAbgJD9mchpp3GHteGBcrZ8A=; b=rM8HUP7vSr369xXLxxXEq8irU 6fYZedFYbcmsD4l6CFVXW6O2OuPWWY2G5S43+xBj28YCuydxJHW9C+7j+97g0dclDqeaqhiB2BRMw Neyk4Rv0vCqD3SisQlkqp1TapRCHQMYCdZZY5b+8a0nlxFMV1vmflyeR5jy0Mier7hLjk=; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, Mark Brown , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The tegra driver requests a supply using regulator_get_optional() but both the name of the supply and the usage pattern suggest that it is being used for the main power for the device and is not at all optional for the device for function, there is no meaningful handling for absent supplies. Such regulators should use the vanilla regulator_get() interface, it will ensure that even if a supply is not described in the system integration one will be provided in software. Signed-off-by: Mark Brown --- drivers/gpu/drm/tegra/dpaux.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 622cdf1ad246..38686f56ea2f 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -505,18 +505,14 @@ static int tegra_dpaux_probe(struct platform_device *pdev) return err; } - dpaux->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); + dpaux->vdd = devm_regulator_get(&pdev->dev, "vdd"); if (IS_ERR(dpaux->vdd)) { - if (PTR_ERR(dpaux->vdd) != -ENODEV) { - if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER) - dev_err(&pdev->dev, - "failed to get VDD supply: %ld\n", - PTR_ERR(dpaux->vdd)); - - return PTR_ERR(dpaux->vdd); - } + if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER) + dev_err(&pdev->dev, + "failed to get VDD supply: %ld\n", + PTR_ERR(dpaux->vdd)); - dpaux->vdd = NULL; + return PTR_ERR(dpaux->vdd); } platform_set_drvdata(pdev, dpaux); @@ -731,11 +727,9 @@ int drm_dp_aux_attach(struct drm_dp_aux *aux, struct tegra_output *output) if (output->panel) { enum drm_connector_status status; - if (dpaux->vdd) { - err = regulator_enable(dpaux->vdd); - if (err < 0) - return err; - } + err = regulator_enable(dpaux->vdd); + if (err < 0) + return err; timeout = jiffies + msecs_to_jiffies(250); @@ -767,11 +761,9 @@ int drm_dp_aux_detach(struct drm_dp_aux *aux) if (dpaux->output->panel) { enum drm_connector_status status; - if (dpaux->vdd) { - err = regulator_disable(dpaux->vdd); - if (err < 0) - return err; - } + err = regulator_disable(dpaux->vdd); + if (err < 0) + return err; timeout = jiffies + msecs_to_jiffies(250);