From patchwork Wed Sep 4 12:30:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 172927 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1163658ily; Wed, 4 Sep 2019 05:30:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyixyzgvdRqYzyBC6oKcNGPyNUOhr4HrZD8KqoJfItVtgbAGlTRGBF2ddEnSXN47CgD5ed4 X-Received: by 2002:a65:684a:: with SMTP id q10mr35254971pgt.417.1567600242158; Wed, 04 Sep 2019 05:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567600242; cv=none; d=google.com; s=arc-20160816; b=BEGlsCMkcdKe2khyiBiS2TV6g7Q9wL6Ipy8cj1cjsxZwtYlaWhqwaQwGmFXYr88g+4 K1W8LXjdO2Tke4o880Fq+/uSe1AhEjXqIAeXos8b8qB1Lvt+1SUqXpW6EvYYCyZFK1uJ TNY9jFth9D6YVM5VA/LENeT1RxUw4Y7UVmU+vn7gTL2r2eH3LDAzl3ee2vuK9/IUapsb g1INx3kG98D/ure52TGKmaL003ovnZJnqXvMeagELuIXbNl6BIH5bKvTXlmE8Xi65Bq3 KNaqBdrKWUYp5pxwDl+5pbwLyq/csJAPPPexxEfHsfnIzKybiQ+xS1vLFmmi2s0n5LBz fOlQ== 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=NAvakg8h+HHFjyN1qYZudmE+UKQljY6AevxpfV9SUV4=; b=K27s1CUMBI87GAahlsKZTrFssqdTNxm7B2oSsPl7HDselZfSaxr7Tx8Xqfx2+89UU3 tM4zv2zByRwqTT+gU3jorPFl0Tw2qRe6yXWRGgayftFkhSnpbgY64qd3nrquBpx1KGbQ RWkqwW4m67YrzRMPLXRmGKJ8/Epk6gM5DFc2qJiWdQ8FlNi06g00eXhEmYKJDNRGr8KS +7c7+l++snlagNW3KW0gFKHx1jhunWrbJF5RFW9hR+CKkMyn0gBq6Sy/VQ1lZZ5PtL/F ml5uzcw8qc7tIenNHB03XB3SnRS8tIuXVGiC5PJJtr9AeXwtbzLTSm8nnTdJ5eQs8FwS 94CQ== 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 o71si2286354pjo.53.2019.09.04.05.30.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 05:30:42 -0700 (PDT) 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 7F4F3894A7; Wed, 4 Sep 2019 12:30:40 +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 93764894A7 for ; Wed, 4 Sep 2019 12:30:39 +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 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 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 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=g/BsOG3t1AtJ5lMidOZwhIOXQj5VBbo4erwS718yjdc=; b=R+3E/74urBfbdKLa0LkBouwQU 82f/5/S15HmEO89PYuLHVCX06uO6Wz8UzeBYsQbrmSvLx4fZx7caz6juXIO0MA9kbjanRyfwYwk1t X60CYJj2Yx19r7Z29FAOmwm/jdiM7aUtzU5NmSCtATR9jMg38QTczNdolNhSUKms3sMyk=; 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: Mark Brown , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Signed-off-by: Steven Price --- 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)