public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] ACPI: Drop parent field from struct acpi_device
@ 2022-08-29  8:41 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-08-29  8:41 UTC (permalink / raw)
  To: rafael.j.wysocki; +Cc: linux-acpi

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

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

only message in thread, other threads:[~2022-08-29  8:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-29  8:41 [bug report] ACPI: Drop parent field from struct acpi_device Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox