Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp633157ybe; Wed, 4 Sep 2019 05:33:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMvpWme+fWePBBp45CuNYs6cM7Vff5s9M9NnhqGrGDM2WZFpxnRgYmCMHxoMTgE4eSTDz4 X-Received: by 2002:a17:90a:d792:: with SMTP id z18mr4774143pju.36.1567600387325; Wed, 04 Sep 2019 05:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567600387; cv=none; d=google.com; s=arc-20160816; b=Z48yI0f1bUqOmIIudbIkj+nit1tivU4Yh1U76jFeQbgK2ASfpoL1XlG3znm1sdi45K fAycwHh1cDD6EmyEInZd5aeaV/4/zgcMItUHUo3/WvbJSAyt/BI9GXV6XIpj1ep2i8QJ 36RJwUeWDOiN6bwVA3MVuymxxyaaOO11r9YoatpffLySNWvL0SFBCRB8re7/mJIhLPNg 68Vt/xTahBaWB5KY1vXHhGiwHFgPpv0EEUkD8sKxKrs9pWkl/uQDar1deCtjMarzpBAo BvsWTehimAlDRvqiYf0ob9bWsmHJlcogfE/KUkdrOjy1Q/sacbaMgIc/FPcfg6pL5XUT 2d1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=g/BsOG3t1AtJ5lMidOZwhIOXQj5VBbo4erwS718yjdc=; b=nXRIw1DDf5UNTDxGrNUCcQ+sIHfxqtk+g2UpLddECZCVIZTnBvhw8Kc7uCOe80thM4 CBhJkySPA1gfpIFuoZxuAQorHwzb66tzCOEAvTFrqT32CGV8r5G3gCcr+vTyLIfoDtW4 8Cepnwp4/ytB9mGQ+HKMRZjZUGRdt7Ta6clYMGC1jRlb5dBpYWBrTYWFrsQ6vJnIHJfN yT/ZbsvoglIPRivOCIm6pgDgABhOwMEjk9Rqk4butnEOaHttORIfnc0hHhabMYRU2Qja knPxzPmwPz0ha9/5R3tGHMmkDKx5drVto5OOhsWc/obFyQcgg5TCrpvnKrH15W1hGurp QNcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="R+3E/74u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si12247491pfa.186.2019.09.04.05.32.51; Wed, 04 Sep 2019 05:33:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="R+3E/74u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729677AbfIDMaj (ORCPT + 99 others); Wed, 4 Sep 2019 08:30:39 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:43282 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbfIDMaj (ORCPT ); Wed, 4 Sep 2019 08:30:39 -0400 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=g/BsOG3t1AtJ5lMidOZwhIOXQj5VBbo4erwS718yjdc=; b=R+3E/74urBfbdKLa0LkBouwQU 82f/5/S15HmEO89PYuLHVCX06uO6Wz8UzeBYsQbrmSvLx4fZx7caz6juXIO0MA9kbjanRyfwYwk1t X60CYJj2Yx19r7Z29FAOmwm/jdiM7aUtzU5NmSCtATR9jMg38QTczNdolNhSUKms3sMyk=; 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 1i5UQk-0005VG-SA; Wed, 04 Sep 2019 12:30:34 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 9E7B92742B45; Wed, 4 Sep 2019 13:30:33 +0100 (BST) From: Mark Brown To: Rob Herring , Tomeu Vizoso , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Mark Brown Subject: [PATCH] drm/panfrost: Fix regulator_get_optional() misuse Date: Wed, 4 Sep 2019 13:30:32 +0100 Message-Id: <20190904123032.23263-1-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The panfrost 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/panfrost/panfrost_device.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 46b0b02e4289..238fb6d54df4 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -89,12 +89,9 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) { int ret; - pfdev->regulator = devm_regulator_get_optional(pfdev->dev, "mali"); + pfdev->regulator = devm_regulator_get(pfdev->dev, "mali"); if (IS_ERR(pfdev->regulator)) { ret = PTR_ERR(pfdev->regulator); - pfdev->regulator = NULL; - if (ret == -ENODEV) - return 0; dev_err(pfdev->dev, "failed to get regulator: %d\n", ret); return ret; } @@ -110,8 +107,7 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) static void panfrost_regulator_fini(struct panfrost_device *pfdev) { - if (pfdev->regulator) - regulator_disable(pfdev->regulator); + regulator_disable(pfdev->regulator); } int panfrost_device_init(struct panfrost_device *pfdev) -- 2.20.1