1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

Kernel: Make UserOrKernelBuffer return KResult from read/write/memset

This allows us to simplify a whole bunch of call sites with TRY(). :^)
This commit is contained in:
Andreas Kling 2021-09-07 12:09:52 +02:00
parent 7bf8844499
commit b481132418
29 changed files with 85 additions and 118 deletions

View file

@ -135,7 +135,7 @@ void BMIDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult re
if (result == AsyncDeviceRequest::Success) {
if (current_request->request_type() == AsyncBlockDeviceRequest::Read) {
if (!current_request->write_to_buffer(current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), 512 * current_request->block_count())) {
if (auto result = current_request->write_to_buffer(current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), 512 * current_request->block_count()); result.is_error()) {
lock.unlock();
current_request->complete(AsyncDeviceRequest::MemoryFault);
return;
@ -164,7 +164,7 @@ void BMIDEChannel::ata_write_sectors(bool slave_request, u16 capabilities)
prdt().offset = m_dma_buffer_page->paddr().get();
prdt().size = 512 * m_current_request->block_count();
if (!m_current_request->read_from_buffer(m_current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), 512 * m_current_request->block_count())) {
if (auto result = m_current_request->read_from_buffer(m_current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), 512 * m_current_request->block_count()); result.is_error()) {
complete_current_request(AsyncDeviceRequest::MemoryFault);
return;
}