diff mbox series

[v2,2/2] wifi: ray_cs: add sanity check on local->sram/rmem/amem

Message ID 20230316133236.556198-3-dzm91@hust.edu.cn (mailing list archive)
State Accepted
Commit 072210c725c4938682e58236eeeb19a2ddd0b817
Delegated to: Kalle Valo
Headers show
Series [v2,1/2] wifi: ray_cs: remove one redundant del_timer | expand

Commit Message

Dongliang Mu March 16, 2023, 1:32 p.m. UTC
The ray_config uses ray_release as its unified error handling function.
However, it does not know if local->sram/rmem/amem succeeds or not.

Fix this by adding sanity check on local->sram/rmem/amem in the
ray_relase.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/net/wireless/ray_cs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index ce7911137014..808b37352f39 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -732,9 +732,12 @@  static void ray_release(struct pcmcia_device *link)
 
 	del_timer_sync(&local->timer);
 
-	iounmap(local->sram);
-	iounmap(local->rmem);
-	iounmap(local->amem);
+	if (local->sram)
+		iounmap(local->sram);
+	if (local->rmem)
+		iounmap(local->rmem);
+	if (local->amem)
+		iounmap(local->amem);
 	pcmcia_disable_device(link);
 
 	dev_dbg(&link->dev, "ray_release ending\n");