All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: k.kozlowski@samsung.com
Cc: linux-input@vger.kernel.org
Subject: re: power_supply: Change ownership from driver to core
Date: Mon, 23 Mar 2015 17:54:33 +0300	[thread overview]
Message-ID: <20150323145433.GA1609@mwanda> (raw)

Hello Krzysztof Kozlowski,

The patch 297d716f6260: "power_supply: Change ownership from driver
to core" from Mar 12, 2015, leads to the following static checker
warning:

	drivers/hid/hid-input.c:457 hidinput_setup_battery()
	error: potential NULL dereference 'dev->battery'.

drivers/hid/hid-input.c
   448          dev->battery = power_supply_register(&dev->dev, psy_desc, &psy_cfg);
   449          if (IS_ERR(dev->battery)) {
   450                  hid_warn(dev, "can't register power supply: %ld\n",
   451                                  PTR_ERR(dev->battery));
   452                  kfree(psy_desc->name);
   453                  kfree(psy_desc);
   454                  dev->battery = NULL;

Set to NULL.

   455          }
   456  
   457          power_supply_powers(dev->battery, &dev->dev);

Dereferenced inside function call.

   458  
   459  out:
   460          return true;
   461  }

regards,
dan carpenter

             reply	other threads:[~2015-03-23 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23 14:54 Dan Carpenter [this message]
2015-03-23 15:21 ` power_supply: Change ownership from driver to core Krzysztof Kozlowski
2015-03-23 16:38   ` Dan Carpenter

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=20150323145433.GA1609@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-input@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 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.