diff options
author | Liav A <liavalb@gmail.com> | 2021-11-28 09:13:45 +0200 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-11-27 23:43:56 -0800 |
commit | 8abc4fa8c222cafe5e80052ce04c5f52a4d1ce6a (patch) | |
tree | 090bb9a855346d9ccaf10d5a1ffdf2e3f1845d2b | |
parent | 45844f933845c203fd8aa2a31022ea917f231407 (diff) | |
download | serenity-8abc4fa8c222cafe5e80052ce04c5f52a4d1ce6a.zip |
Kernel/Audio: Implement 2 correctness fixes in AC97
The fixes are:
1. Don't copy PCI::DeviceIdentifier during construction. This is a heavy
structure to copy so we definitely don't want to do that. Instead, use
a const reference to it like what happens in other parts in the Kernel.
2. Declare the constructor as explicit to avoid construction errors.
-rw-r--r-- | Kernel/Devices/Audio/AC97.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/Audio/AC97.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Devices/Audio/AC97.cpp b/Kernel/Devices/Audio/AC97.cpp index 507efdafa2..f16ddc82c3 100644 --- a/Kernel/Devices/Audio/AC97.cpp +++ b/Kernel/Devices/Audio/AC97.cpp @@ -44,7 +44,7 @@ UNMAP_AFTER_INIT void AC97::detect() }); } -UNMAP_AFTER_INIT AC97::AC97(PCI::DeviceIdentifier pci_device_identifier) +UNMAP_AFTER_INIT AC97::AC97(PCI::DeviceIdentifier const& pci_device_identifier) : PCI::Device(pci_device_identifier.address()) , IRQHandler(pci_device_identifier.interrupt_line().value()) , CharacterDevice(42, 42) diff --git a/Kernel/Devices/Audio/AC97.h b/Kernel/Devices/Audio/AC97.h index af5ca5c389..aae4c7dc58 100644 --- a/Kernel/Devices/Audio/AC97.h +++ b/Kernel/Devices/Audio/AC97.h @@ -145,7 +145,7 @@ private: StringView m_name; }; - AC97(PCI::DeviceIdentifier); + explicit AC97(PCI::DeviceIdentifier const&); // ^IRQHandler virtual bool handle_irq(const RegisterState&) override; |