git: 237d5b05f5bb - stable/15 - acpi: Return "unknown D-state" in acpi_d_state_to_str() if unknown
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 19 Apr 2026 13:54:41 UTC
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]);
}