summaryrefslogtreecommitdiff
path: root/Kernel/Devices/HID
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-07 12:09:52 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-07 13:53:14 +0200
commitb4811324183cc64bd671f93c889fa5e6590e0182 (patch)
tree083ec95329a20fbcf74f78ce8ea2bf3c9a4055b8 /Kernel/Devices/HID
parent7bf88444993a72f588ce3bd849042c3420e222a7 (diff)
downloadserenity-b4811324183cc64bd671f93c889fa5e6590e0182.zip
Kernel: Make UserOrKernelBuffer return KResult from read/write/memset
This allows us to simplify a whole bunch of call sites with TRY(). :^)
Diffstat (limited to 'Kernel/Devices/HID')
-rw-r--r--Kernel/Devices/HID/MouseDevice.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Devices/HID/MouseDevice.cpp b/Kernel/Devices/HID/MouseDevice.cpp
index 80c4a1ef73..6ad5658900 100644
--- a/Kernel/Devices/HID/MouseDevice.cpp
+++ b/Kernel/Devices/HID/MouseDevice.cpp
@@ -39,8 +39,7 @@ KResultOr<size_t> MouseDevice::read(FileDescription&, u64, UserOrKernelBuffer& b
dbgln_if(MOUSE_DEBUG, "PS2 Mouse Read: Filter packets");
size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket));
- if (!buffer.write(&packet, nread, bytes_read_from_packet))
- return EFAULT;
+ TRY(buffer.write(&packet, nread, bytes_read_from_packet));
nread += bytes_read_from_packet;
remaining_space_in_buffer -= bytes_read_from_packet;