dev/pci: Unmap memory on allocation failure

This commit is contained in:
2026-11-02 21:53:06 +01:00
committed by Marvin Friedrich
parent 54f279a9e6
commit fd50c97f1a
3 changed files with 24 additions and 4 deletions
+7 -1
View File
@@ -224,8 +224,14 @@ errno_t pci_setup_msix(struct pci_device* dev, struct irq_line** out) {
return ENOMEM;
for (size_t i = 0; i < map_len; i += page_size) {
status = pmap_map(&kernel_vma.pmap, vaddr + i, page_base + i, PTE_READ | PTE_WRITE, CACHE_MMIO);
if (status)
if (status) {
while (i) {
i -= page_size;
pmap_unmap(&kernel_vma.pmap, vaddr + i);
}
vm_free(vaddr, map_len);
return status;
}
}
void* entry = (void*)(vaddr + page_offset);