Kernel: Make UHCIController::spawn_port_process OOM-fallible
This commit is contained in:
parent
ad7d4d9be1
commit
c131e69748
Notes:
sideshowbarker
2024-07-17 20:06:00 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/c131e69748e Pull-request: https://github.com/SerenityOS/serenity/pull/12179
2 changed files with 5 additions and 9 deletions
|
@ -76,7 +76,7 @@ ErrorOr<void> UHCIController::initialize()
|
|||
dmesgln("UHCI: I/O base {}", m_io_base);
|
||||
dmesgln("UHCI: Interrupt line: {}", interrupt_number());
|
||||
|
||||
spawn_port_process();
|
||||
TRY(spawn_port_process());
|
||||
|
||||
TRY(reset());
|
||||
return start();
|
||||
|
@ -464,15 +464,10 @@ size_t UHCIController::poll_transfer_queue(QueueHead& transfer_queue)
|
|||
return transfer_size;
|
||||
}
|
||||
|
||||
void UHCIController::spawn_port_process()
|
||||
ErrorOr<void> UHCIController::spawn_port_process()
|
||||
{
|
||||
RefPtr<Thread> usb_hotplug_thread;
|
||||
|
||||
auto process_name = KString::try_create("UHCI hotplug");
|
||||
if (process_name.is_error())
|
||||
TODO();
|
||||
|
||||
(void)Process::create_kernel_process(usb_hotplug_thread, process_name.release_value(), [&] {
|
||||
(void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI hotplug")), [&] {
|
||||
for (;;) {
|
||||
if (m_root_hub)
|
||||
m_root_hub->check_for_port_updates();
|
||||
|
@ -480,6 +475,7 @@ void UHCIController::spawn_port_process()
|
|||
(void)Thread::current()->sleep(Time::from_seconds(1));
|
||||
}
|
||||
});
|
||||
return {};
|
||||
}
|
||||
|
||||
bool UHCIController::handle_irq(const RegisterState&)
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
virtual ErrorOr<void> reset() override;
|
||||
virtual ErrorOr<void> stop() override;
|
||||
virtual ErrorOr<void> start() override;
|
||||
void spawn_port_process();
|
||||
ErrorOr<void> spawn_port_process();
|
||||
|
||||
virtual ErrorOr<size_t> submit_control_transfer(Transfer& transfer) override;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue