linux-clk.vger.kernel.org archive mirror
 help / color / mirror / 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	[thread overview]
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	other threads:[~2019-09-13 14:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13  2:40 [PATCH] clk: Make clk_bulk_get_all() return a valid "id" 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 publicly 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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).