1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +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:
Liav A 2023-04-26 17:19:05 +03:00 committed by Andreas Kling
parent 87a32ab869
commit bc3eb6d65f
4 changed files with 7 additions and 11 deletions

View file

@ -146,9 +146,7 @@ VirtIOGraphicsAdapter::VirtIOGraphicsAdapter(PCI::DeviceIdentifier const& device
ErrorOr<void> VirtIOGraphicsAdapter::initialize_virtio_resources()
{
TRY(VirtIO::Device::initialize_virtio_resources());
auto* config = get_config(VirtIO::ConfigurationType::Device);
if (!config)
return Error::from_errno(ENODEV);
auto* config = TRY(get_config(VirtIO::ConfigurationType::Device));
m_device_configuration = config;
bool success = negotiate_features([&](u64 supported_features) {
u64 negotiated = 0;