linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: PM / clock_ops: Add pm_clk_add_clk()
@ 2014-11-11 13:04 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-11-11 13:04 UTC (permalink / raw)
  To: geert+renesas; +Cc: linux-pm

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-11 13:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-11 13:04 PM / clock_ops: Add pm_clk_add_clk() Dan Carpenter

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).