Kernel: Some clang-tidy fixes in Bus/VirtIO

This commit is contained in:
Hendiadyoin1 2021-12-08 14:00:18 +01:00 committed by Brian Gianforcaro
parent 471b38db68
commit 9be409585c
Notes: sideshowbarker 2024-07-17 23:00:43 +09:00
5 changed files with 11 additions and 9 deletions

View file

@ -22,7 +22,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<Console> Console::must_create(PCI::DeviceIdentifi
UNMAP_AFTER_INIT void Console::initialize()
{
Device::initialize();
if (auto cfg = get_config(ConfigurationType::Device)) {
if (auto const* cfg = get_config(ConfigurationType::Device)) {
bool success = negotiate_features([&](u64 supported_features) {
u64 negotiated = 0;
if (is_feature_set(supported_features, VIRTIO_CONSOLE_F_SIZE))
@ -156,7 +156,8 @@ void Console::process_control_message(ControlMessage message)
if (id >= m_ports.size()) {
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", id, m_ports.size());
return;
} else if (!m_ports.at(id).is_null()) {
}
if (!m_ports.at(id).is_null()) {
dbgln("Device tried to add port {} which was already added!", id);
return;
}
@ -178,7 +179,8 @@ void Console::process_control_message(ControlMessage message)
if (message.id >= m_ports.size()) {
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", message.id, m_ports.size());
return;
} else if (m_ports.at(message.id).is_null()) {
}
if (m_ports.at(message.id).is_null()) {
dbgln("Device tried to open port {} which was not added!", message.id);
return;
}

View file

@ -46,7 +46,7 @@ UNMAP_AFTER_INIT void detect()
});
}
static StringView const determine_device_class(PCI::DeviceIdentifier const& device_identifier)
static StringView determine_device_class(PCI::DeviceIdentifier const& device_identifier)
{
if (device_identifier.revision_id().value() == 0) {
// Note: If the device is a legacy (or transitional) device, therefore,

View file

@ -121,7 +121,7 @@ protected:
const Configuration* get_config(ConfigurationType cfg_type, u32 index = 0) const
{
for (auto& cfg : m_configs) {
for (auto const& cfg : m_configs) {
if (cfg.cfg_type != cfg_type)
continue;
if (index > 0) {

View file

@ -118,9 +118,9 @@ Optional<u16> Queue::take_free_slot()
m_free_head = m_descriptors[descriptor_index].next;
--m_free_buffers;
return descriptor_index;
} else {
return {};
}
return {};
}
bool Queue::should_notify() const

View file

@ -116,8 +116,8 @@ public:
QueueChain(QueueChain&& other)
: m_queue(other.m_queue)
, m_start_of_chain_index(other.m_start_of_chain_index)
, m_end_of_chain_index(other.m_end_of_chain_index)
, m_start_of_chain_index(move(other.m_start_of_chain_index))
, m_end_of_chain_index(move(other.m_end_of_chain_index))
, m_chain_length(other.m_chain_length)
, m_chain_has_writable_pages(other.m_chain_has_writable_pages)
{