summaryrefslogtreecommitdiff
path: root/Kernel/Net/E1000NetworkAdapter.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-08 00:19:46 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-08 00:19:46 +0100
commita3f39fe789380ff0a577083993bbd0cda0e9e55e (patch)
treedeb5042ac0b62913668ab4dc2f727ead2d0dd142 /Kernel/Net/E1000NetworkAdapter.cpp
parentf3a5985bb2ffef9b1094d3672a51df81bdf80431 (diff)
downloadserenity-a3f39fe789380ff0a577083993bbd0cda0e9e55e.zip
Net: Make NetworkAdapter reference-counted
The idea behind WeakPtr<NetworkAdapter> was to support hot-pluggable network adapters, but on closer thought, that's super impractical so let's not go down that road.
Diffstat (limited to 'Kernel/Net/E1000NetworkAdapter.cpp')
-rw-r--r--Kernel/Net/E1000NetworkAdapter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp
index a62fe622c3..d4f05871c3 100644
--- a/Kernel/Net/E1000NetworkAdapter.cpp
+++ b/Kernel/Net/E1000NetworkAdapter.cpp
@@ -128,7 +128,7 @@ void E1000NetworkAdapter::detect(const PCI::Address& address)
if (id != qemu_bochs_vbox_id)
return;
u8 irq = PCI::get_interrupt_line(address);
- new E1000NetworkAdapter(address, irq);
+ (void)adopt(*new E1000NetworkAdapter(address, irq)).leak_ref();
}
E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address pci_address, u8 irq)
@@ -376,7 +376,7 @@ void E1000NetworkAdapter::send_raw(const u8* data, size_t length)
#endif
auto& descriptor = m_tx_descriptors[tx_current];
ASSERT(length <= 8192);
- auto *vptr = (void*)(descriptor.addr + 0xc0000000);
+ auto* vptr = (void*)(descriptor.addr + 0xc0000000);
memcpy(vptr, data, length);
descriptor.length = length;
descriptor.status = 0;