summaryrefslogtreecommitdiff
path: root/Kernel/Bus
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-14 15:15:11 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-14 15:19:00 +0200
commit7676edfb9ba4d5052978968ba31ef940153ea7a9 (patch)
treec068023ed273da25fbecea848becc6848c738809 /Kernel/Bus
parentd30d776ca46b12d7f4f9b5b7bdbfb247813a94af (diff)
downloadserenity-7676edfb9ba4d5052978968ba31ef940153ea7a9.zip
Kernel: Stop allowing implicit conversion from KResult to int
This patch removes KResult::operator int() and deals with the fallout. This forces a lot of code to be more explicit in its handling of errors, greatly improving readability.
Diffstat (limited to 'Kernel/Bus')
-rw-r--r--Kernel/Bus/USB/UHCIController.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/Kernel/Bus/USB/UHCIController.cpp b/Kernel/Bus/USB/UHCIController.cpp
index 3a6c52d95b..7d36c3ae58 100644
--- a/Kernel/Bus/USB/UHCIController.cpp
+++ b/Kernel/Bus/USB/UHCIController.cpp
@@ -591,16 +591,8 @@ KResultOr<size_t> UHCIController::submit_control_transfer(Transfer& transfer)
TransferDescriptor* last_data_descriptor;
TransferDescriptor* data_descriptor_chain;
auto buffer_address = Ptr32<u8>(transfer.buffer_physical().as_ptr() + sizeof(USBRequestData));
- auto transfer_chain_create_result = create_chain(pipe,
- direction_in ? PacketID::IN : PacketID::OUT,
- buffer_address,
- pipe.max_packet_size(),
- transfer.transfer_data_size(),
- &data_descriptor_chain,
- &last_data_descriptor);
-
- if (transfer_chain_create_result != KSuccess)
- return transfer_chain_create_result;
+ if (auto result = create_chain(pipe, direction_in ? PacketID::IN : PacketID::OUT, buffer_address, pipe.max_packet_size(), transfer.transfer_data_size(), &data_descriptor_chain, &last_data_descriptor); result.is_error())
+ return result;
// Status TD always has toggle set to 1
pipe.set_toggle(true);