acpi_spmc: fix revision check reading name as integer

In acpi_spmc_get_constraints_spec(), the revision of the device
constraint detail package was mistakenly read from
constraint_obj->Package.Elements[0], which is the device name
(a string), instead of from the detail sub-package's first element.

Move the initialisation of 'detail' before the revision check and
read the revision from detail->Package.Elements[0] as the comment
already states

Approved by:	obiwac
Differential Revision:	https://reviews.freebsd.org/D55639
Sponsored by:	Netflix
This commit is contained in:
Olivier Cochard
2026-03-04 00:05:04 +01:00
parent f268f95955
commit 4d876fc5fc
+2 -2
View File
@@ -322,11 +322,12 @@ acpi_spmc_get_constraints_spec(struct acpi_spmc_softc *sc, ACPI_OBJECT *object)
return (ENOMEM);
}
detail = &constraint_obj->Package.Elements[2];
/*
* The first element in the device constraint detail package is
* the revision, and should always be zero.
*/
revision = constraint_obj->Package.Elements[0].Integer.Value;
revision = detail->Package.Elements[0].Integer.Value;
if (revision != 0) {
device_printf(sc->dev, "Unknown revision %d for "
"device constraint detail package\n", revision);
@@ -334,7 +335,6 @@ acpi_spmc_get_constraints_spec(struct acpi_spmc_softc *sc, ACPI_OBJECT *object)
continue;
}
detail = &constraint_obj->Package.Elements[2];
constraint_package = &detail->Package.Elements[1];
constraint->lpi_uid =