summaryrefslogtreecommitdiff
path: root/Kernel/Devices/HID/PS2KeyboardDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Devices/HID/PS2KeyboardDevice.cpp')
-rw-r--r--Kernel/Devices/HID/PS2KeyboardDevice.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Kernel/Devices/HID/PS2KeyboardDevice.cpp b/Kernel/Devices/HID/PS2KeyboardDevice.cpp
index e81ea7fa0c..0b569b632f 100644
--- a/Kernel/Devices/HID/PS2KeyboardDevice.cpp
+++ b/Kernel/Devices/HID/PS2KeyboardDevice.cpp
@@ -83,9 +83,11 @@ bool PS2KeyboardDevice::handle_irq(const RegisterState&)
UNMAP_AFTER_INIT RefPtr<PS2KeyboardDevice> PS2KeyboardDevice::try_to_initialize(const I8042Controller& ps2_controller)
{
- auto device = adopt_ref(*new PS2KeyboardDevice(ps2_controller));
- if (device->initialize())
- return device;
+ auto keyboard_device_or_error = try_create_device<PS2KeyboardDevice>(ps2_controller);
+ // FIXME: Find a way to propagate errors
+ VERIFY(!keyboard_device_or_error.is_error());
+ if (keyboard_device_or_error.value()->initialize())
+ return keyboard_device_or_error.release_value();
return nullptr;
}