git: a87bde85232e - main - acpi_spmc: Simplify constraint freeing

From: Aymeric Wibo <obiwac_at_FreeBSD.org>
Date: Sat, 21 Mar 2026 05:21:08 UTC
The branch main has been updated by obiwac:

URL: https://cgit.FreeBSD.org/src/commit/?id=a87bde85232e60771691649fd5718a6de5453e59

commit a87bde85232e60771691649fd5718a6de5453e59
Author:     Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-03-21 05:19:21 +0000
Commit:     Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-03-21 05:20:46 +0000

    acpi_spmc: Simplify constraint freeing
    
    We don't need to check for NULL before calling free().
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/dev/acpica/acpi_spmc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index 6b4363bb364d..a961b4a188dc 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -274,13 +274,9 @@ acpi_spmc_check_dsm_set(struct acpi_spmc_softc *sc, ACPI_HANDLE handle,
 static void
 acpi_spmc_free_constraints(struct acpi_spmc_softc *sc)
 {
-	if (sc->constraints == NULL)
-		return;
-
-	for (size_t i = 0; i < sc->constraint_count; i++) {
-		if (sc->constraints[i].name != NULL)
-			free(sc->constraints[i].name, M_TEMP);
-	}
+	for (size_t i = 0; i < sc->constraint_count; i++)
+		free(sc->constraints[i].name, M_TEMP);
+	sc->constraint_count = 0;
 
 	free(sc->constraints, M_TEMP);
 	sc->constraints = NULL;