Kernel: Fix reboot when ACPI is disabled

If ACPI was disabled ACPI::reset() would page fault when accessing
namespace instead of checking wheter namespace is initialized :D
This commit is contained in:
Bananymous 2025-02-11 21:53:20 +02:00
parent 088f77a226
commit 83c66901f8
1 changed files with 7 additions and 1 deletions

View File

@ -469,6 +469,9 @@ acpi_release_global_lock:
BAN::ErrorOr<void> ACPI::prepare_sleep(uint8_t sleep_state)
{
if (!m_namespace)
return BAN::Error::from_errno(EFAULT);
auto [pts_path, pts_object] = TRY(m_namespace->find_named_object({}, MUST(AML::NameString::from_string("\\_PTS"))));
if (pts_object == nullptr)
return {};
@ -584,7 +587,10 @@ acpi_release_global_lock:
return BAN::Error::from_errno(EFAULT);
}
TRY(prepare_sleep(5));
if (!m_namespace)
dwarnln("ACPI namespace not initialized, will not evaluate \\_S5");
else
TRY(prepare_sleep(5));
dprintln("Resetting system");