public inbox for linux-acpi@vger.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: [bug report] ACPI: Drop parent field from struct acpi_device
Date: Mon, 29 Aug 2022 11:41:09 +0300	[thread overview]
Message-ID: <Ywx7pdtirM9DWMps@kili> (raw)

Hello Rafael J. Wysocki,

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

The patch 62fcb99bdf10: "ACPI: Drop parent field from struct
acpi_device" from Aug 24, 2022, leads to the following Smatch
complaint:

    drivers/acpi/device_pm.c:166 acpi_device_set_power()
    warn: variable dereferenced before check 'device' (see line 162)

drivers/acpi/device_pm.c
   161	{
   162		struct acpi_device *parent = acpi_dev_parent(device);
                                                             ^^^^^^
Dereverence

   163		int target_state = state;
   164		int result = 0;
   165	
   166		if (!device || !device->flags.power_manageable
                    ^^^^^^^
Checked too late.

   167		    || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
   168			return -EINVAL;

regards,
dan carpenter

                 reply	other threads:[~2022-08-29  8:41 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=Ywx7pdtirM9DWMps@kili \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox