Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4808994pxu; Tue, 22 Dec 2020 01:03:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoEMbwCEdkf0XaylOIPdovkihGv8LCMrMEsS9nX2DlX1XQ+BhSH29Q+WHg/B+rlJJI/I/r X-Received: by 2002:a17:907:961b:: with SMTP id gb27mr1674738ejc.313.1608627835202; Tue, 22 Dec 2020 01:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608627835; cv=none; d=google.com; s=arc-20160816; b=gUgfCvpOx1XBeYAtgPVgWt81ul2dH2NjIGa4dz8cmgQwvIiFituXZrxgIz0nvkQVZM VWPJF+R+LLpJapeMUmmhM5OMEJX1Bwhbz9iacTx+qg00tEgDg3sPI3G3GeDoTc6qNEUJ L98ACt8rxb5ynGmAsMiktKNxtoO/yZfmL/Pw7cdECQKq+LM7egkGTB6ogqsn0x7MLNrm Kbho7v1nnnQU76IDqv4lglCeVZnYwmw9/qxDobFj/Q6eaLBOyH8y0jMfdtT7KkLEJk2W dMNh3eIhFLwJ0nTLS+HXgk2QKYwUtGu0eVOqaaAPI9FwdBIaW50+NWq2axJ+368XjiFN zd+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3q7nnCnJmd4O4D32PC0P8xH1+bdbk1CdNF9NmfMW4t0=; b=wJIQsToS/RDUfNgUkCKxnI/9hGfravDBw1mVgCDe9+DMmyTXJkigUuontq8a64vXlV 23Igt9B9i7CkGMqpJ7iKphtDJHPrJVjzyMC4xOjpgll+3zDl5GSjAKXiXhHKSKn9ZJyJ SSdIlZZgNb4c48uUu9dfCsA6Q3t3j0N5C8cTp2znQ+aSFQIvfa6M3oo8ZsuOQkZMxwL9 XJHP4Cxdck+SilXdlmSuDTFIMfasJdXyjdgxAl6QpiGuNSZOnfTCVT1wKj7BcBPI7QfH 6JQD2AxUVrP2PdXwxmHiU0NIT/YteTO6DeltBC4+RpSBan9U/01SANhTuGN95+SdlTWF zNsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sw8hWqsm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si10266663ejy.309.2020.12.22.01.03.31; Tue, 22 Dec 2020 01:03:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sw8hWqsm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725885AbgLVJCX (ORCPT + 99 others); Tue, 22 Dec 2020 04:02:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbgLVJCW (ORCPT ); Tue, 22 Dec 2020 04:02:22 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A05BC061793 for ; Tue, 22 Dec 2020 01:01:42 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id e2so7976258pgi.5 for ; Tue, 22 Dec 2020 01:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3q7nnCnJmd4O4D32PC0P8xH1+bdbk1CdNF9NmfMW4t0=; b=Sw8hWqsmWEV28OZ97FyOgXyFgk5shKHWAxZzHcRzRhaM/6+T4brrF3/aXanmbfPjRw /A9CHWFxY/26ovZDBEoLzvrVEQgYuX/8xBOFFAOh2S++/KtpIaGJfhKZuA8vaiEUG6N5 RDqNcxOViH+za8EEfeOTF4OJ0FgNLYkqGyciyEF6yFonDS/ytj6QebompmK2qd5iwMxT f60gJWZOOaEE42z2GFxRM7tJMnnNTqxHJqeFzNzO5GVHLT7/VnICWMEMwFNfUuNd7lT8 CMqaiMF7EhSgACQ9J+vlj6sz3hYK3bX6+CzSrtrtNmrSTvIrdM+em0PwSBTuQL1T2brh GG/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3q7nnCnJmd4O4D32PC0P8xH1+bdbk1CdNF9NmfMW4t0=; b=HvtIgRK9RpS25XwVtpyAl2+jkbO6TudPVR4SRxd8lx0zjpZ1lYdZhttAY12PetAmGd vyXgZkvIUses1OHnQe3fY0JDw6w9gawEtG1YP3sRXpcNuHcpjfCF1odELvFq2WBVb4L2 wc+FOViTYuNuHElcI14N15CX9g3xGHOaZe/Vms+9btAR8FqDR1cMXsAhFSFyI+OQ251V BQlrPAHYqe7dzA6IaGn7WZoSvgKhaDRCBXqrsCqH9NusGxA8bBGVPI8I7jX+mzRxCzCd AhNgAOy+fCRg1cSBe2hV6uDIbLAmZmYdoQHbi1JVLexB/ztji1s3eG9/3ZfXUYf+UtlZ +/iw== X-Gm-Message-State: AOAM532wYnsogpuMZhOHBNyQDslDsahTiD+uFCxMqNlKZg7ogQgT76cR bUI/xxYrKF7pTRY15QtWUVyBOQ== X-Received: by 2002:a62:864e:0:b029:1ab:e82c:d724 with SMTP id x75-20020a62864e0000b02901abe82cd724mr15830943pfd.9.1608627701598; Tue, 22 Dec 2020 01:01:41 -0800 (PST) Received: from localhost ([122.172.20.109]) by smtp.gmail.com with ESMTPSA id o14sm14548124pgr.44.2020.12.22.01.01.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2020 01:01:40 -0800 (PST) Date: Tue, 22 Dec 2020 14:31:39 +0530 From: Viresh Kumar To: Dmitry Osipenko Cc: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Mauro Carvalho Chehab , Rob Herring , Peter Geis , Nicolas Chauvet , Krzysztof Kozlowski , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Michael Turquette , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-clk@vger.kernel.org Subject: Re: [PATCH v2 15/48] opp: Support set_opp() customization without requiring to use regulators Message-ID: <20201222090139.vopgc2ju72kr4ujy@vireshk-i7> References: <20201217180638.22748-1-digetx@gmail.com> <20201217180638.22748-16-digetx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217180638.22748-16-digetx@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-12-20, 21:06, Dmitry Osipenko wrote: > Support set_opp() customization without requiring to use regulators. This > is needed by drivers which want to use dev_pm_opp_set_rate() for changing > rates of a multiple clocks and don't need to touch regulator. > > One example is NVIDIA Tegra30/114 SoCs which have two sibling 3D hardware > units which should be use to the same clock rate, meanwhile voltage > scaling is done using a power domain. In this case OPP table doesn't have > a regulator, causing a NULL dereference in _set_opp_custom(). > > Signed-off-by: Dmitry Osipenko > --- > drivers/opp/core.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 3d02fe33630b..625dae7a5ecb 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -828,17 +828,25 @@ static int _set_opp_custom(const struct opp_table *opp_table, > struct dev_pm_opp_supply *old_supply, > struct dev_pm_opp_supply *new_supply) > { > - struct dev_pm_set_opp_data *data; > + struct dev_pm_set_opp_data *data, tmp_data; > + unsigned int regulator_count; > int size; > > - data = opp_table->set_opp_data; > + if (opp_table->set_opp_data) { > + data = opp_table->set_opp_data; > + regulator_count = opp_table->regulator_count; > + } else { > + data = &tmp_data; > + regulator_count = 0; > + } > + > data->regulators = opp_table->regulators; > - data->regulator_count = opp_table->regulator_count; > + data->regulator_count = regulator_count; > data->clk = opp_table->clk; > data->dev = dev; > > data->old_opp.rate = old_freq; > - size = sizeof(*old_supply) * opp_table->regulator_count; > + size = sizeof(*old_supply) * regulator_count; > if (!old_supply) > memset(data->old_opp.supplies, 0, size); > else I don't see you making use of this in this patchset. How did you get this to crash ? -- viresh