diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-07 12:09:52 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-07 13:53:14 +0200 |
commit | b4811324183cc64bd671f93c889fa5e6590e0182 (patch) | |
tree | 083ec95329a20fbcf74f78ce8ea2bf3c9a4055b8 /Kernel/Bus/USB | |
parent | 7bf88444993a72f588ce3bd849042c3420e222a7 (diff) | |
download | serenity-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/Bus/USB')
-rw-r--r-- | Kernel/Bus/USB/SysFSUSB.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Kernel/Bus/USB/SysFSUSB.cpp b/Kernel/Bus/USB/SysFSUSB.cpp index ab8a57f387..bd4549e10e 100644 --- a/Kernel/Bus/USB/SysFSUSB.cpp +++ b/Kernel/Bus/USB/SysFSUSB.cpp @@ -87,9 +87,7 @@ KResultOr<size_t> SysFSUSBDeviceInformation::read_bytes(off_t offset, size_t cou return 0; ssize_t nread = min(static_cast<off_t>(data_buffer->size() - offset), static_cast<off_t>(count)); - if (!buffer.write(data_buffer->data() + offset, nread)) - return KResult(EFAULT); - + TRY(buffer.write(data_buffer->data() + offset, nread)); return nread; } |