diff options
author | Joshua Bakita <jbakita@cs.unc.edu> | 2023-06-28 18:49:51 -0400 |
---|---|---|
committer | Joshua Bakita <jbakita@cs.unc.edu> | 2023-06-28 18:49:51 -0400 |
commit | 7e8fc4f9ae9fb4424aab73622cd9d7b89390dcb3 (patch) | |
tree | 1a62feadf86d8898896560896d1498a8ef859e7a /nvdebug_entry.c | |
parent | 01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (diff) |
Fix deinitialization on non-PCIe devices
Diffstat (limited to 'nvdebug_entry.c')
-rw-r--r-- | nvdebug_entry.c | 16 |
1 files changed, 9 insertions, 7 deletions
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) { | |||
267 | char device_id[7]; | 267 | char device_id[7]; |
268 | snprintf(device_id, 7, "gpu%d", g_nvdebug_devices); | 268 | snprintf(device_id, 7, "gpu%d", g_nvdebug_devices); |
269 | remove_proc_subtree(device_id, NULL); | 269 | remove_proc_subtree(device_id, NULL); |
270 | // Free BAR mappings | 270 | // Free BAR mappings for PCIe devices |
271 | g = &g_nvdebug_state[g_nvdebug_devices]; | 271 | g = &g_nvdebug_state[g_nvdebug_devices]; |
272 | if (g && g->regs) | 272 | if (g && g->pcid) { |
273 | pci_iounmap(g->pcid, g->regs); | 273 | if (g && g->regs) |
274 | if (g && g->bar2) | 274 | pci_iounmap(g->pcid, g->regs); |
275 | pci_iounmap(g->pcid, g->bar2); | 275 | if (g && g->bar2) |
276 | // TEMP | 276 | pci_iounmap(g->pcid, g->bar2); |
277 | free_irq(g->pcid->irq, g->pcid); | 277 | // TEMP |
278 | free_irq(g->pcid->irq, g->pcid); | ||
279 | } | ||
278 | printk(KERN_INFO "[nvdebug] Chip ID %x deinitialized.", g->chip_id); | 280 | printk(KERN_INFO "[nvdebug] Chip ID %x deinitialized.", g->chip_id); |
279 | } | 281 | } |
280 | printk(KERN_INFO "[nvdebug] Module exit complete.\n"); | 282 | printk(KERN_INFO "[nvdebug] Module exit complete.\n"); |