linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ray Jui <rjui@broadcom.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <linux-clk@vger.kernel.org>
Subject: Re: clk: iproc: add initial common clock support
Date: Fri, 26 Jun 2015 08:31:31 -0700	[thread overview]
Message-ID: <558D7053.1000106@broadcom.com> (raw)
In-Reply-To: <20150626102010.GA32189@mwanda>

Hi Dan,

On 6/26/2015 3:20 AM, Dan Carpenter wrote:
> Hello Ray Jui,
> 
> The patch 5fe225c105fd: "clk: iproc: add initial common clock
> support" from May 5, 2015, leads to the following static checker
> warning:
> 
> 	drivers/clk/bcm/clk-iproc-asiu.c:229 iproc_asiu_setup()
> 	warn: did you mean to pass the address of 'clk_name'
> 
> drivers/clk/bcm/clk-iproc-asiu.c
>    218          for (i = 0; i < num_clks; i++) {
>    219                  struct clk_init_data init;
>    220                  struct clk *clk;
>    221                  const char *parent_name;
>    222                  struct iproc_asiu_clk *asiu_clk;
>    223                  const char *clk_name;
>    224  
>    225                  clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL);
> 
> We shouldn't do this allocation.  of_property_read_string_index() will
> just re-assign "clk_name" so the memory is leaked.
> 

I'll submit a patch to fix this. Thanks.

>    226                  if (WARN_ON(!clk_name))
>    227                          goto err_clk_register;
>    228  
>    229                  ret = of_property_read_string_index(node, "clock-output-names",
>    230                                                      i, &clk_name);
>    231                  if (WARN_ON(ret))
>    232                          goto err_clk_register;
>    233  
>    234                  asiu_clk = &asiu->clks[i];
>    235                  asiu_clk->name = clk_name;
>    236                  asiu_clk->asiu = asiu;
>    237                  asiu_clk->div = div[i];
>    238                  asiu_clk->gate = gate[i];
>    239                  init.name = clk_name;
>    240                  init.ops = &iproc_asiu_ops;
>    241                  init.flags = 0;
>    242                  parent_name = of_clk_get_parent_name(node, 0);
>    243                  init.parent_names = (parent_name ? &parent_name : NULL);
>    244                  init.num_parents = (parent_name ? 1 : 0);
>    245                  asiu_clk->hw.init = &init;
> 
> 
> regards,
> dan carpenter
> 

  reply	other threads:[~2015-06-26 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 10:20 clk: iproc: add initial common clock support Dan Carpenter
2015-06-26 15:31 ` Ray Jui [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-26 10:23 Dan Carpenter
2015-06-26 15:34 ` Ray Jui

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=558D7053.1000106@broadcom.com \
    --to=rjui@broadcom.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-clk@vger.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).