linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: geert+renesas@glider.be
Cc: linux-pm@vger.kernel.org
Subject: re: PM / clock_ops: Add pm_clk_add_clk()
Date: Tue, 11 Nov 2014 16:04:14 +0300	[thread overview]
Message-ID: <20141111130414.GB19962@mwanda> (raw)

Hello Geert Uytterhoeven,

The patch 245bd6f6af8a: "PM / clock_ops: Add pm_clk_add_clk()" from
Nov 6, 2014, leads to the following static checker warning:

	drivers/base/power/clock_ops.c:98 __pm_clk_add()
	warn: 'ce->clk' isn't an ERR_PTR

drivers/base/power/clock_ops.c
    74  static int __pm_clk_add(struct device *dev, const char *con_id,
    75                          struct clk *clk)
    76  {
    77          struct pm_subsys_data *psd = dev_to_psd(dev);
    78          struct pm_clock_entry *ce;
    79  
    80          if (!psd)
    81                  return -EINVAL;
    82  
    83          ce = kzalloc(sizeof(*ce), GFP_KERNEL);
    84          if (!ce) {
    85                  dev_err(dev, "Not enough memory for clock entry.\n");
    86                  return -ENOMEM;
    87          }
    88  
    89          if (con_id) {
    90                  ce->con_id = kstrdup(con_id, GFP_KERNEL);
    91                  if (!ce->con_id) {
    92                          dev_err(dev,
    93                                  "Not enough memory for clock connection ID.\n");
    94                          kfree(ce);
    95                          return -ENOMEM;
    96                  }
    97          } else {
    98                  if (IS_ERR(ce->clk) || !__clk_get(clk)) {
                                   ^^^^^^^
ce->clk is still zero because it comes from kzalloc().  I don't know
what was intended here.

    99                          kfree(ce);
   100                          return -ENOENT;
   101                  }
   102                  ce->clk = clk;
   103          }

regards,
dan carpenter

                 reply	other threads:[~2014-11-11 13:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20141111130414.GB19962@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-pm@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).