From b0fc5bea91534d7bb00f51ae48e881696dba5564 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Fri, 1 Mar 2024 14:21:10 +0100 Subject: [PATCH] Kernel/PCI: Prefer structured bindings when iterating over HashMaps This makes `Access::rescan_hardware` look a bit nicer. --- Kernel/Bus/PCI/Access.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp index 5a0318f42f1..e45531d4519 100644 --- a/Kernel/Bus/PCI/Access.cpp +++ b/Kernel/Bus/PCI/Access.cpp @@ -162,8 +162,8 @@ UNMAP_AFTER_INIT void Access::rescan_hardware() SpinlockLocker scan_locker(m_scan_lock); VERIFY(m_device_identifiers.is_empty()); ErrorOr error_or_void {}; - for (auto it = m_host_controllers.begin(); it != m_host_controllers.end(); ++it) { - (*it).value->enumerate_attached_devices([this, &error_or_void](EnumerableDeviceIdentifier device_identifier) -> IterationDecision { + for (auto& [_, host_controller] : m_host_controllers) { + host_controller->enumerate_attached_devices([this, &error_or_void](EnumerableDeviceIdentifier device_identifier) -> IterationDecision { auto device_identifier_or_error = DeviceIdentifier::from_enumerable_identifier(device_identifier); if (device_identifier_or_error.is_error()) { error_or_void = device_identifier_or_error.release_error();