[PATCH 1/2] PCMCIA: Deletion of checks before the function call "iounmap"

SF Markus Elfring elfring at users.sourceforge.net
Sun Jan 18 11:02:49 PST 2015


From: Markus Elfring <elfring at users.sourceforge.net>
Date: Sun, 18 Jan 2015 18:48:09 +0100

The iounmap() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
---
 drivers/pcmcia/bcm63xx_pcmcia.c | 6 ++----
 drivers/pcmcia/cistpl.c         | 3 +--
 drivers/pcmcia/electra_cf.c     | 6 ++----
 drivers/pcmcia/yenta_socket.c   | 3 +--
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/pcmcia/bcm63xx_pcmcia.c b/drivers/pcmcia/bcm63xx_pcmcia.c
index 0802e0b..9e7ad1b 100644
--- a/drivers/pcmcia/bcm63xx_pcmcia.c
+++ b/drivers/pcmcia/bcm63xx_pcmcia.c
@@ -426,10 +426,8 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev)
 	return 0;
 
 err:
-	if (skt->io_base)
-		iounmap(skt->io_base);
-	if (skt->base)
-		iounmap(skt->base);
+	iounmap(skt->io_base);
+	iounmap(skt->base);
 	if (skt->reg_res)
 		release_mem_region(skt->reg_res->start, regmem_size);
 	kfree(skt);
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 884a984..662462e 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -115,8 +115,7 @@ static void __iomem *set_cis_map(struct pcmcia_socket *s,
 	}
 
 	if (s->features & SS_CAP_STATIC_MAP) {
-		if (s->cis_virt)
-			iounmap(s->cis_virt);
+		iounmap(s->cis_virt);
 		s->cis_virt = ioremap(mem->static_start, s->map_size);
 	}
 
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 7f9950d..3fb78d6 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -316,10 +316,8 @@ fail1:
 
 	if (cf->io_virt)
 		__iounmap_at(cf->io_virt, cf->io_size);
-	if (cf->mem_base)
-		iounmap(cf->mem_base);
-	if (cf->gpio_base)
-		iounmap(cf->gpio_base);
+	iounmap(cf->mem_base);
+	iounmap(cf->gpio_base);
 	device_init_wakeup(&ofdev->dev, 0);
 	kfree(cf);
 	return status;
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 8a23ccb..5ea1d49 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -802,8 +802,7 @@ static void yenta_close(struct pci_dev *dev)
 	else
 		del_timer_sync(&sock->poll_timer);
 
-	if (sock->base)
-		iounmap(sock->base);
+	iounmap(sock->base);
 	yenta_free_resources(sock);
 
 	pci_release_regions(dev);
-- 
2.2.2




More information about the linux-pcmcia mailing list