linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: bq2415x_charger: Allow to load and use driver even if notify device is not registered yet
@ 2015-09-12 19:50 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-09-12 19:50 UTC (permalink / raw)
  To: pali.rohar; +Cc: linux-pm

Hello Pali Rohár,

This is a semi-automatic email about new static checker warnings.

The patch b68c3161430a: "bq2415x_charger: Allow to load and use 
driver even if notify device is not registered yet" from Aug 11, 
2015, leads to the following Smatch complaint:

drivers/power/bq2415x_charger.c:1707 bq2415x_probe()
	 error: we previously assumed 'bq' could be null (see line 1581)

drivers/power/bq2415x_charger.c
  1580		bq = devm_kzalloc(&client->dev, sizeof(*bq), GFP_KERNEL);
  1581		if (!bq) {
  1582			ret = -ENOMEM;
  1583			goto error_2;

"bq" is NULL.

  1584		}

[ snip ]

  1702	error_4:
  1703		bq2415x_sysfs_exit(bq);
  1704	error_3:
  1705		bq2415x_power_supply_exit(bq);
  1706	error_2:
  1707		if (bq->notify_node)

Patch adds a dereference.  Also the GW-BASIC label names are so ugly and
inflexible, it's better to choose meaningful names that say what the
label does like err_sysfs_exit, err_power_supply_exit, and err_node_put.

  1708			of_node_put(bq->notify_node);\
  1709		kfree(name);

regards,
dan carpenter

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

only message in thread, other threads:[~2015-09-12 19:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-12 19:50 bq2415x_charger: Allow to load and use driver even if notify device is not registered yet 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).