linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: rjui@broadcom.com
Cc: linux-clk@vger.kernel.org
Subject: re: clk: iproc: add initial common clock support
Date: Fri, 26 Jun 2015 13:20:10 +0300	[thread overview]
Message-ID: <20150626102010.GA32189@mwanda> (raw)

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.

   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 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 10:20 Dan Carpenter [this message]
2015-06-26 15:31 ` clk: iproc: add initial common clock support Ray Jui
  -- 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=20150626102010.GA32189@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=rjui@broadcom.com \
    /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).