Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2683176imj; Mon, 11 Feb 2019 07:00:06 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib1FNvQdCJaLDPTVeVR0cZ+C/ZnC5yocsbIxZcRn3HuA7naA5p3ylJ6ZdUj6nIM6s3xOeGh X-Received: by 2002:a17:902:7683:: with SMTP id m3mr25339030pll.191.1549897206248; Mon, 11 Feb 2019 07:00:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897206; cv=none; d=google.com; s=arc-20160816; b=u+DjDdCrIcelkqf+4QQPbPeaIkjWIqGdAtdM/yimnrTJkSmozShQjhbN6d0tolUQAe IBJYEep1BnzpSubtJnlyhoOfkpLbV9P7oKqMRx3DWf1/jfhjmElAPmfieb6jvf4tA96E Dj16RCjzijgyX0kLiCUd07L2FIR6Xajt9/6qnqKHLTrlU6RRLQBHamtMxMeLHZOhu+zt HNnZRACpgdmPn3ZkJ0sI4Djs31VxP3VToKFX9C4wN/cP28J9YVktpmAroZO7dKZaaIHH MYkuEJlUCYAQak8N1x9tKMagjGHw1SNn8sDy3K0L7l8VgaT6HWIxQxAPoM+G5VYMkeG2 GoZg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K34QuYYw/GSac9eCgIlkRS+kdNomuZdAoUkgQdYS03k=; b=QUWmLyoY26OrKFbwofl1aoET6vuqc+xxZLAmJBc39dIA1eNb6PmrcroS8n+JKjKPHM iT4l4dPENz9+s8VnGLez7X65sZ7+7xiu3YNK9qVZgDqUQ9unQGEDXco5WaCAI0Hw9yaH g6Y9Ma7DBD3RyzPnBwXl3e5kJhjvUBPZc40LSDeuiwvwrNZ5ksqE92t0RCbG76COncqB BeDiMmqTGqem11YgDuWCCWchgBL72Grgqb1cqg7FdG6qjHrbquvV4pMtywka7ma1xg4B 3NZnMYo4Gx09H55d63pVNf9iO1PxNQEV+ameMsLQ1vSx5DtSyLZc1/O7qntE1tkWXRMy DCVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1a30w75a; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d130si9531515pgc.232.2019.02.11.06.59.49; Mon, 11 Feb 2019 07:00:06 -0800 (PST) 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=pass header.i=@kernel.org header.s=default header.b=1a30w75a; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389682AbfBKO65 (ORCPT + 99 others); Mon, 11 Feb 2019 09:58:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:46680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389639AbfBKO64 (ORCPT ); Mon, 11 Feb 2019 09:58:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69771206BA; Mon, 11 Feb 2019 14:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897135; bh=lZb+i/9y5Mbhi+T/BYfc4CDwL3ZPogCfMeFtdXFdDw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1a30w75aVYGRwyklRvm3jgAEsOAch44gIVZKWwj5YoO+SWzvKrAiZu/2RmHKrpnlB T1ReQcALlM82iklbm2osHAfnzr65t1BT2trg1740vbyPC0SS72tieDXOwXwZuW493i KuEovFGfUwofo99CNs2LZr9WW3NRIhC7lAw6yDoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Perret , Viresh Kumar , Sasha Levin Subject: [PATCH 4.14 085/205] OPP: Use opp_table->regulators to verify no regulator case Date: Mon, 11 Feb 2019 15:18:03 +0100 Message-Id: <20190211141834.242061203@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 90e3577b5feb42bac1269e16bb3d2bdd8f6df40f ] The value of opp_table->regulator_count is not very consistent right now and it may end up being 0 while we do have a "opp-microvolt" property in the OPP table. It was kept that way as we used to check if any regulators are set with the OPP core for a device or not using value of regulator_count. Lets use opp_table->regulators for that purpose as the meaning of regulator_count is going to change in the later patches. Reported-by: Quentin Perret Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/base/power/opp/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index d4862775b9f6..d5e7e8cc4f22 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -192,12 +192,12 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) if (IS_ERR(opp_table)) return 0; - count = opp_table->regulator_count; - /* Regulator may not be required for the device */ - if (!count) + if (!opp_table->regulators) goto put_opp_table; + count = opp_table->regulator_count; + uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL); if (!uV) goto put_opp_table; @@ -921,6 +921,9 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp, struct regulator *reg; int i; + if (!opp_table->regulators) + return true; + for (i = 0; i < opp_table->regulator_count; i++) { reg = opp_table->regulators[i]; @@ -1226,7 +1229,7 @@ static int _allocate_set_opp_data(struct opp_table *opp_table) struct dev_pm_set_opp_data *data; int len, count = opp_table->regulator_count; - if (WARN_ON(!count)) + if (WARN_ON(!opp_table->regulators)) return -EINVAL; /* space for set_opp_data */ -- 2.19.1