All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: rafael.j.wysocki@intel.com
Cc: linux-acpi@vger.kernel.org
Subject: re: ACPI / scan: Simplify acpi_match_device()
Date: Mon, 13 Apr 2015 22:21:59 +0300	[thread overview]
Message-ID: <20150413192159.GA10774@mwanda> (raw)

Hello Rafael J. Wysocki,

The patch e1acdeb0e770: "ACPI / scan: Simplify acpi_match_device()"
from Apr 10, 2015, leads to the following static checker warning:

	drivers/acpi/scan.c:269 acpi_companion_match()
	error: potential NULL dereference 'adev'.

drivers/acpi/scan.c
   247  static struct acpi_device *acpi_companion_match(const struct device *dev)
   248  {
   249          struct acpi_device *adev;
   250  
   251          adev = ACPI_COMPANION(dev);
   252          if (!adev)
   253                  return NULL;
   254  
   255          if (list_empty(&adev->pnp.ids))
   256                  return NULL;
   257  
   258          mutex_lock(&adev->physical_node_lock);
   259          if (list_empty(&adev->physical_node_list)) {
   260                  adev = NULL;
                        ^^^^^^^^^^^
   261          } else {
   262                  const struct acpi_device_physical_node *node;
   263  
   264                  node = list_first_entry(&adev->physical_node_list,
   265                                          struct acpi_device_physical_node, node);
   266                  if (node->dev != dev)
   267                          adev = NULL;
                                ^^^^^^^^^^^^
   268          }
   269          mutex_unlock(&adev->physical_node_lock);
                              ^^^^^^
Dereference.

   270  
   271          return adev;
   272  }

regards,
dan carpenter

             reply	other threads:[~2015-04-13 19:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 19:21 Dan Carpenter [this message]
2015-04-13 19:59 ` ACPI / scan: Simplify acpi_match_device() Rafael J. Wysocki
2015-04-14 10:37   ` Mika Westerberg

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=20150413192159.GA10774@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.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.