Commit b879dc4b3e81069e3f715b7569bb0f43eed76c76

Authored by Rafael J. Wysocki
Committed by Jesse Barnes
1 parent 79dd9182db

ACPI/PCI: Reorder checks in acpi_pci_osc_control_set()

Make acpi_pci_osc_control_set() attempt to find the handle of the
_OSC object under the given PCI root bridge object after verifying
that its second argument is correct and that there is a struct
acpi_pci_root object for the given root bridge handle, which is
more logical than the old code.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

drivers/acpi/pci_root.c
... ... @@ -378,10 +378,6 @@
378 378 acpi_handle tmp;
379 379 struct acpi_pci_root *root;
380 380  
381   - status = acpi_get_handle(handle, "_OSC", &tmp);
382   - if (ACPI_FAILURE(status))
383   - return status;
384   -
385 381 control_req = (flags & OSC_PCI_CONTROL_MASKS);
386 382 if (!control_req)
387 383 return AE_TYPE;
... ... @@ -389,6 +385,10 @@
389 385 root = acpi_pci_find_root(handle);
390 386 if (!root)
391 387 return AE_NOT_EXIST;
  388 +
  389 + status = acpi_get_handle(handle, "_OSC", &tmp);
  390 + if (ACPI_FAILURE(status))
  391 + return status;
392 392  
393 393 mutex_lock(&osc_lock);
394 394 /* No need to evaluate _OSC if the control was already granted. */