Linux-Clk Archive on lore.kernel.org
 help / color / Atom feed
From: Jordan Crouse <jcrouse@codeaurora.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	Dong Aisheng <aisheng.dong@nxp.com>
Subject: Re: [PATCH] clk: Make clk_bulk_get_all() return a valid "id"
Date: Fri, 13 Sep 2019 08:44:45 -0600
Message-ID: <20190913144444.GA25762@jcrouse1-lnx.qualcomm.com> (raw)
In-Reply-To: <20190913024029.2640-1-bjorn.andersson@linaro.org>

On Thu, Sep 12, 2019 at 07:40:29PM -0700, Bjorn Andersson wrote:
> The adreno driver expects the "id" field of the returned clk_bulk_data
> to be filled in with strings from the clock-names property.
> 
> But due to the use of kmalloc_array() in of_clk_bulk_get_all() it
> receives a list of bogus pointers instead.
> 
> Zero-initialize the "id" field and attempt to populate with strings from
> the clock-names property to resolve both these issues.

This looks great to me.  Thanks for fixing that so quickly.

Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>

> Fixes: 616e45df7c4a ("clk: add new APIs to operate on all available clocks")
> Fixes: 8e3e791d20d2 ("drm/msm: Use generic bulk clock function")
> Cc: Dong Aisheng <aisheng.dong@nxp.com>
> Cc: Jordan Crouse <jcrouse@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  drivers/clk/clk-bulk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
> index 524bf9a53098..e9e16425c739 100644
> --- a/drivers/clk/clk-bulk.c
> +++ b/drivers/clk/clk-bulk.c
> @@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
>  	int ret;
>  	int i;
>  
> -	for (i = 0; i < num_clks; i++)
> +	for (i = 0; i < num_clks; i++) {
> +		clks[i].id = NULL;
>  		clks[i].clk = NULL;
> +	}
>  
>  	for (i = 0; i < num_clks; i++) {
> +		of_property_read_string_index(np, "clock-names", i, &clks[i].id);
>  		clks[i].clk = of_clk_get(np, i);
>  		if (IS_ERR(clks[i].clk)) {
>  			ret = PTR_ERR(clks[i].clk);
> -- 
> 2.18.0
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13  2:40 Bjorn Andersson
2019-09-13 14:44 ` Jordan Crouse [this message]
2019-09-17 20:33 ` Stephen Boyd
2019-09-17 20:42   ` Bjorn Andersson

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190913144444.GA25762@jcrouse1-lnx.qualcomm.com \
    --to=jcrouse@codeaurora.org \
    --cc=aisheng.dong@nxp.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Clk Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-clk/0 linux-clk/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-clk linux-clk/ https://lore.kernel.org/linux-clk \
		linux-clk@vger.kernel.org linux-clk@archiver.kernel.org
	public-inbox-index linux-clk


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-clk


AGPL code for this site: git clone https://public-inbox.org/ public-inbox