MA-22773 fix panic when shutting down

The "card->handle" could be null if any wifi error
happened before. Need to check the "card->handle"
before we try to access it, or below kernel panic
would happen:
	[2024-08-16 02:05:27] [13042.551314][    T1] Call trace:
	[2024-08-16 02:05:27] [13042.554541][    T1] woal_pcie_shutdown+0x34/0xe8 [moal 056f086fd2e165369160d7a4749320d91d2cdde0]
	[2024-08-16 02:05:27] [13042.563612][    T1] pci_device_shutdown+0x4c/0x60
	[2024-08-16 02:05:27] [13042.568494][    T1] device_shutdown+0x1ac/0x270
	[2024-08-16 02:05:27] [13042.573199][    T1]  kernel_restart+0x40/0x114
	[2024-08-16 02:05:27] [13042.577735][    T1] __arm64_sys_reboot+0x19c/0x26c
	[2024-08-16 02:05:27] [13042.582702][    T1]  invoke_syscall+0x58/0x114
	[2024-08-16 02:05:27] [13042.587235][    T1]  el0_svc_common+0xac/0xe0
	[2024-08-16 02:05:27] [13042.591681][    T1]  do_el0_svc+0x1c/0x28
	[2024-08-16 02:05:27] [13042.595780][    T1]  el0_svc+0x38/0x68
	[2024-08-16 02:05:27] [13042.599616][    T1] el0t_64_sync_handler+0x68/0xbc
	[2024-08-16 02:05:27] [13042.604581][    T1]  el0t_64_sync+0x1a8/0x1ac
	[2024-08-16 02:05:27] [13042.609027][    T1] Code: f940ae68 b4000168 f9400514 528da408 (38686a88)
	[2024-08-16 02:05:27] [13042.615901][    T1] ---[ end trace 0000000000000000 ]---

Change-Id: Idec523c970c9c9bc53ee4a08ed40cb5dccf05309
Signed-off-by: Ji Luo <ji.luo@nxp.com>
This commit is contained in:
Ji Luo 2024-08-20 16:53:18 +09:00
parent 3df11f19c8
commit 51328249e3

View file

@ -699,6 +699,12 @@ static void woal_pcie_shutdown(struct pci_dev *dev)
return; return;
} }
handle = card->handle; handle = card->handle;
if (!handle) {
PRINTM(MINFO, "PCIE card handle is null!\n");
pci_disable_device(dev);
LEAVE();
return;
}
if (handle->second_mac) if (handle->second_mac)
goto done; goto done;
#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ #if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \