git: dc9ff9e5d078 - main - acpi: Return "unknown D-state" in acpi_d_state_to_str() if unknown
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 07:17:42 UTC
The branch main has been updated by obiwac:
URL: https://cgit.FreeBSD.org/src/commit/?id=dc9ff9e5d078fd923adc3dc5426b5f219156ea43
commit dc9ff9e5d078fd923adc3dc5426b5f219156ea43
Author: Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-04-16 07:12:33 +0000
Commit: Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-04-16 07:17:07 +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
---
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 1099e7a25b0a..7bcac6239253 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -507,6 +507,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]);
}