diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index 33915b53666..9a4264d6785 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -223,7 +223,9 @@ struct acpi_spmc_softc { struct eventhandler_entry *eh_suspend; struct eventhandler_entry *eh_resume; - bool constraints_populated; +#ifdef INVARIANTS + bool get_constraints_succeeded; +#endif size_t constraint_count; struct acpi_spmc_constraint *constraints; }; @@ -488,8 +490,6 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc *sc, ACPI_OBJECT *objec ACPI_OBJECT *detail; ACPI_OBJECT *constraint_package; - KASSERT(!sc->constraints_populated, ("Constraints already populated")); - sc->constraint_count = object->Package.Count; sc->constraints = malloc(sc->constraint_count * sizeof *sc->constraints, M_TEMP, M_WAITOK | M_ZERO); @@ -536,7 +536,6 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc *sc, ACPI_OBJECT *objec constraint_package->Package.Elements[2].Integer.Value; } - sc->constraints_populated = true; return (0); } @@ -549,8 +548,6 @@ acpi_spmc_parse_constraints_amd(struct acpi_spmc_softc *sc, ACPI_OBJECT *object) struct acpi_spmc_constraint *constraint; ACPI_OBJECT *name_obj; - KASSERT(!sc->constraints_populated, ("Constraints already populated")); - /* * First element in the package is unknown. * Second element is the number of device constraints. @@ -596,7 +593,6 @@ acpi_spmc_parse_constraints_amd(struct acpi_spmc_softc *sc, ACPI_OBJECT *object) constraint_obj->Package.Elements[3].Integer.Value; } - sc->constraints_populated = true; return (0); } @@ -613,8 +609,8 @@ acpi_spmc_get_constraints(device_t dev) struct acpi_spmc_constraint *constraint; sc = device_get_softc(dev); - if (sc->constraints_populated) - return (0); + + MPASS(!sc->get_constraints_succeeded); /* The Microsoft DSM doesn't have this function. */ is_amd = has_dsm(sc, DSM_AMD); @@ -651,6 +647,10 @@ acpi_spmc_get_constraints(device_t dev) constraint->handle = NULL; } } + +#ifdef INVARIANTS + sc->get_constraints_succeeded = true; +#endif return (0); } @@ -661,7 +661,6 @@ acpi_spmc_check_constraints(struct acpi_spmc_softc *sc) bool violation = false; #endif - KASSERT(sc->constraints_populated, ("Constraints not populated")); /* * Avoid printing that constraints are respected when there are no * constraints at all.