From patchwork Wed Sep 4 12:31:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 172928 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1164818ily; Wed, 4 Sep 2019 05:31:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrW6aWuhU23rRXbZIYgnLGtD8CCdtPxMXDghiXPtMfUJ0B5mAMKLA5ty07i5DK2igKkKxj X-Received: by 2002:a17:902:e60c:: with SMTP id cm12mr41069790plb.304.1567600302432; Wed, 04 Sep 2019 05:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567600302; cv=none; d=google.com; s=arc-20160816; b=LT3tpGtmKml+PejE0jgomsYCY4O9j3Sur9AUWcs7ZcUCigh5P7C0Vc7LC5NPbW4wLn WMjFuz/hJ3+h4cYX2OpjlZpxPBH7JF4CAbf9cPi7POKQdoBGLYNqwT99VjchRidUHafL 6c2rNEcVR8yoHgsXb8A+BDNg6SRBXiP3AMdoQmilpha/4uZ8IUjG9AKyAs18I+i6GIT2 eRFx5Kg4M4J1kMN6GfSgUeN9WzxI5WjCKvMZeuJZ2CuVNf1LCYy2HdyejXQ8fNnzIor7 3MnrduML9AyaoW9TvFXvOm0gnRvCGJwN/CazD+0hzV/rjgUOhEAg8s547Smo4nzDZxui kFiA== 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=GJQS4gJTNCVjRGvUWvcmKFiWyiK9BNAlq0ggTUPKG2o=; b=CC8bacITZH67OC2BqRyZjclzs0fVAek/K3ejKZaiRU9nKcSzZUe8R1jOcG3LShNXOG AVyYpBG6oRjRKFaCJzpbspbHZobhW8qkApQOfYlNArq34g0sE/zKOCYsKA4HbEtQv9H+ ZShxpiVVLCELOisej6B2Gv0cK9C+xYUoTYpKHQ+OQn7EhkPDvlIkKIgIAQiQr+6LtzRv WH8Tvn236wuVDFWqeoWpvTL4zNecVl7N1r6cj6L2PE/4BvnUf1Ix0MSvkxeeg+b3zQJX OHopFqdpnlHT2eVUHHdsGDreTB6y/e1/1QsefWe3m1HtTaOZXFWgPrQWtQqxUTAISeDF +kFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ouXJU2+H; 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 r2si17291472pli.327.2019.09.04.05.31.42; Wed, 04 Sep 2019 05:31:42 -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=ouXJU2+H; 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 S1729806AbfIDMbl (ORCPT + 28 others); Wed, 4 Sep 2019 08:31:41 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:45034 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbfIDMbk (ORCPT ); Wed, 4 Sep 2019 08:31:40 -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=GJQS4gJTNCVjRGvUWvcmKFiWyiK9BNAlq0ggTUPKG2o=; b=ouXJU2+HFB3fD9w9XNx7iYXQr uN9s5R5ySnQlfrHgHJtW/lRO1ROvRY5xiDQmCHnlKS3j4a9r8TsviII2WkgFg4GFMVnNSATisBxuw pXvCkBVR7AmBNyWHxdmMp3pW11wKlBXQXUplxXLcPjvA9NWQa2HkTjp9Vh9IXJ4WnG7D4=; Received: from ypsilon.sirena.org.uk ([2001:470:1f1d:6b5::7]) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i5URk-0005Vd-QN; Wed, 04 Sep 2019 12:31:36 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 3017C2742B45; Wed, 4 Sep 2019 13:31:36 +0100 (BST) From: Mark Brown To: Qiang Yu , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Mark Brown Subject: [PATCH] drm/lima: Fix regulator_get_optional() misuse Date: Wed, 4 Sep 2019 13:31:29 +0100 Message-Id: <20190904123129.23351-1-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The lima 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/lima/lima_device.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c index d86b8d81a483..d718ac70df1e 100644 --- a/drivers/gpu/drm/lima/lima_device.c +++ b/drivers/gpu/drm/lima/lima_device.c @@ -142,12 +142,9 @@ static int lima_regulator_init(struct lima_device *dev) { int ret; - dev->regulator = devm_regulator_get_optional(dev->dev, "mali"); + dev->regulator = devm_regulator_get(dev->dev, "mali"); if (IS_ERR(dev->regulator)) { ret = PTR_ERR(dev->regulator); - dev->regulator = NULL; - if (ret == -ENODEV) - return 0; if (ret != -EPROBE_DEFER) dev_err(dev->dev, "failed to get regulator: %d\n", ret); return ret; @@ -164,8 +161,7 @@ static int lima_regulator_init(struct lima_device *dev) static void lima_regulator_fini(struct lima_device *dev) { - if (dev->regulator) - regulator_disable(dev->regulator); + regulator_disable(dev->regulator); } static int lima_init_ip(struct lima_device *dev, int index)