From 7e8fc4f9ae9fb4424aab73622cd9d7b89390dcb3 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Wed, 28 Jun 2023 18:49:51 -0400 Subject: Fix deinitialization on non-PCIe devices --- nvdebug_entry.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'nvdebug_entry.c') diff --git a/nvdebug_entry.c b/nvdebug_entry.c index 695b5fd..fa35fb2 100644 --- a/nvdebug_entry.c +++ b/nvdebug_entry.c @@ -267,14 +267,16 @@ static void __exit nvdebug_exit(void) { char device_id[7]; snprintf(device_id, 7, "gpu%d", g_nvdebug_devices); remove_proc_subtree(device_id, NULL); - // Free BAR mappings + // Free BAR mappings for PCIe devices g = &g_nvdebug_state[g_nvdebug_devices]; - if (g && g->regs) - pci_iounmap(g->pcid, g->regs); - if (g && g->bar2) - pci_iounmap(g->pcid, g->bar2); - // TEMP - free_irq(g->pcid->irq, g->pcid); + if (g && g->pcid) { + if (g && g->regs) + pci_iounmap(g->pcid, g->regs); + if (g && g->bar2) + pci_iounmap(g->pcid, g->bar2); + // TEMP + free_irq(g->pcid->irq, g->pcid); + } printk(KERN_INFO "[nvdebug] Chip ID %x deinitialized.", g->chip_id); } printk(KERN_INFO "[nvdebug] Module exit complete.\n"); -- cgit v1.2.2