diff options
| author | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-04-16 07:12:33 +0000 |
|---|---|---|
| committer | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-04-16 07:17:07 +0000 |
| commit | dc9ff9e5d078fd923adc3dc5426b5f219156ea43 (patch) | |
| tree | 5ed097420de1eb20f87b2058639b6d36f8d65fa2 | |
| parent | 20cd1b475a1ef9dfca30726999aa1b9a02d5bc39 (diff) | |
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
| -rw-r--r-- | sys/dev/acpica/acpivar.h | 2 |
1 files changed, 2 insertions, 0 deletions
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]); } |
