mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
Kernel/VirtIO: Use proper error propagation from the get_config method
This allows us to drop null-checks at call-sites, thus simplifying the code and reducing the chance of nullptr-dereference errors.
This commit is contained in:
parent
87a32ab869
commit
bc3eb6d65f
4 changed files with 7 additions and 11 deletions
|
@ -151,9 +151,9 @@ UNMAP_AFTER_INIT ErrorOr<void> Device::initialize_virtio_resources()
|
|||
auto mapping_io_window = TRY(IOWindow::create_for_pci_device_bar(device_identifier(), static_cast<PCI::HeaderType0BaseRegister>(cfg.bar)));
|
||||
m_register_bases[cfg.bar] = move(mapping_io_window);
|
||||
}
|
||||
m_common_cfg = get_config(ConfigurationType::Common, 0);
|
||||
m_notify_cfg = get_config(ConfigurationType::Notify, 0);
|
||||
m_isr_cfg = get_config(ConfigurationType::ISR, 0);
|
||||
m_common_cfg = TRY(get_config(ConfigurationType::Common, 0));
|
||||
m_notify_cfg = TRY(get_config(ConfigurationType::Notify, 0));
|
||||
m_isr_cfg = TRY(get_config(ConfigurationType::ISR, 0));
|
||||
} else {
|
||||
auto mapping_io_window = TRY(IOWindow::create_for_pci_device_bar(device_identifier(), PCI::HeaderType0BaseRegister::BAR0));
|
||||
m_register_bases[0] = move(mapping_io_window);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue