summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-12-08 14:00:18 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-09 22:53:42 -0800
commit9be409585ca80d2d56112d80d5c4ab2b10aebbd3 (patch)
tree45af9181d439bf13b55907463d69d541201f1f23
parent471b38db6827cefaef149ec999a7258d74a1678a (diff)
downloadserenity-9be409585ca80d2d56112d80d5c4ab2b10aebbd3.zip
Kernel: Some clang-tidy fixes in Bus/VirtIO
-rw-r--r--Kernel/Bus/VirtIO/Console.cpp8
-rw-r--r--Kernel/Bus/VirtIO/Device.cpp2
-rw-r--r--Kernel/Bus/VirtIO/Device.h2
-rw-r--r--Kernel/Bus/VirtIO/Queue.cpp4
-rw-r--r--Kernel/Bus/VirtIO/Queue.h4
5 files changed, 11 insertions, 9 deletions
diff --git a/Kernel/Bus/VirtIO/Console.cpp b/Kernel/Bus/VirtIO/Console.cpp
index 34fa1cc770..9c291a0581 100644
--- a/Kernel/Bus/VirtIO/Console.cpp
+++ b/Kernel/Bus/VirtIO/Console.cpp
@@ -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;
}
diff --git a/Kernel/Bus/VirtIO/Device.cpp b/Kernel/Bus/VirtIO/Device.cpp
index 9b0c5f3cd3..142057b920 100644
--- a/Kernel/Bus/VirtIO/Device.cpp
+++ b/Kernel/Bus/VirtIO/Device.cpp
@@ -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,
diff --git a/Kernel/Bus/VirtIO/Device.h b/Kernel/Bus/VirtIO/Device.h
index a46adebcab..993574a1c7 100644
--- a/Kernel/Bus/VirtIO/Device.h
+++ b/Kernel/Bus/VirtIO/Device.h
@@ -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) {
diff --git a/Kernel/Bus/VirtIO/Queue.cpp b/Kernel/Bus/VirtIO/Queue.cpp
index 7d9aef9f25..1966062dee 100644
--- a/Kernel/Bus/VirtIO/Queue.cpp
+++ b/Kernel/Bus/VirtIO/Queue.cpp
@@ -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
diff --git a/Kernel/Bus/VirtIO/Queue.h b/Kernel/Bus/VirtIO/Queue.h
index a83f4aae3e..b2604e7468 100644
--- a/Kernel/Bus/VirtIO/Queue.h
+++ b/Kernel/Bus/VirtIO/Queue.h
@@ -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)
{