From 39f7f4047e57fc7e7e275e52657f47d3d4bb6e2a Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sun, 29 Oct 2023 13:31:00 -0400 Subject: Zero-out unused/invalid fields in g_nvdebug_device on Tegra devices Previously, unloading the module could cause a segfault on Tegra, as pcid would be unitilized and possibly non-zero, causing us to attempt PCIe-device-style deinitialization on a non-PCEe device. --- nvdebug_entry.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvdebug_entry.c b/nvdebug_entry.c index 4eb44a2..c362209 100644 --- a/nvdebug_entry.c +++ b/nvdebug_entry.c @@ -99,6 +99,8 @@ int probe_and_cache_device(void) { if (ids.raw == -1) return -EADDRNOTAVAIL; g_nvdebug_state[i].chip_id = ids.chip_id; + g_nvdebug_state[i].pcid = NULL; + g_nvdebug_state[i].bar3 = NULL; printk(KERN_INFO "[nvdebug] Chip ID %x (architecture %s) detected on platform bus and initialized.", ids.chip_id, ARCH2NAME(ids.architecture)); i++; -- cgit v1.2.2