From: Dongliang Mu Date: Thu, 16 Mar 2023 13:32:36 +0000 (+0800) Subject: wifi: ray_cs: add sanity check on local->sram/rmem/amem X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=072210c725c4938682e58236eeeb19a2ddd0b817;p=linux.git wifi: ray_cs: add sanity check on local->sram/rmem/amem 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 Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20230316133236.556198-3-dzm91@hust.edu.cn --- diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c index 93eaf3dba6a93..4b53a9c70e7e7 100644 --- a/drivers/net/wireless/legacy/ray_cs.c +++ b/drivers/net/wireless/legacy/ray_cs.c @@ -738,9 +738,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");