All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: pali.rohar@gmail.com
Cc: linux-pm@vger.kernel.org
Subject: re: bq2415x_charger: Allow to load and use driver even if notify device is not registered yet
Date: Sat, 12 Sep 2015 22:50:11 +0300	[thread overview]
Message-ID: <20150912195010.GA10112@mwanda> (raw)

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

                 reply	other threads:[~2015-09-12 19:50 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=20150912195010.GA10112@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali.rohar@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.