Skip to contentSkip to conversation

ACPI: Drop parent field from struct acpi_device

bug report Dan Carpenter 1 participant 1 message Aug 29, 2022 ACPI

lore
Share & tools
lore
#0 lore 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