Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Apr 2026 13:54:41 +0000
From:      Aymeric Wibo <obiwac@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 237d5b05f5bb - stable/15 - acpi: Return "unknown D-state" in acpi_d_state_to_str() if unknown
Message-ID:  <69e4dea1.20337.54481df9@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by obiwac:

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

commit 237d5b05f5bb229db96fdafc59e7f504fc3d039a
Author:     Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-04-16 07:12:33 +0000
Commit:     Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-04-19 13:53:59 +0000

    acpi: Return "unknown D-state" in acpi_d_state_to_str() if unknown
    
    Some ACPI debugging prints call acpi_d_state_to_str() on unset D-states
    (i.e. ACPI_STATE_UNKNOWN), so return a string explicitly saying "unknown
    D-state" instead of just panicking.
    
    Fixes:          84bbfc32a3f4 ("acpi_powerres: D3cold support")
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    
    (cherry picked from commit dc9ff9e5d078fd923adc3dc5426b5f219156ea43)
---
 sys/dev/acpica/acpivar.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 6887f080311d..ea416402f530 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -523,6 +523,8 @@ acpi_d_state_to_str(int state)
     const char *strs[ACPI_D_STATE_COUNT] = {"D0", "D1", "D2", "D3hot",
 	"D3cold"};
 
+    if (state == ACPI_STATE_UNKNOWN)
+	return ("unknown D-state");
     MPASS(state >= ACPI_STATE_D0 && state <= ACPI_D_STATES_MAX);
     return (strs[state]);
 }


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e4dea1.20337.54481df9>