aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-02-05 01:27:44 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:09 -0500
commit5a1c3e1aa977457ded6fd0739e032c9684bf23bd (patch)
tree89eb509f436e1ad20362cce9cd83529888de16c4 /drivers/pcmcia
parent4c1fc445c29c6208c44e10c0253beea890bf5435 (diff)
drivers/pcmcia: Add missing iounmap
of_iomap calls ioremap, and so should be matched with an iounmap. At the two error returns, the result of calling of_iomap is only stored in a local variable, so these error paths need to call iounmap. Furthermore, this function ultimately stores the result of of_iomap in an array that is local to the file. These values should be iounmapped at some point. I have added a corresponding call to iounmap at the end of the function m8xx_remove. The problem was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ type T,T1,T2; identifier E; statement S; expression x1,x2,x3; int ret; @@ T E; ... * E = of_iomap(...); if (E == NULL) S ... when != iounmap(...,(T1)E,...) when != if (E != NULL) { ... iounmap(...,(T1)E,...); ...} when != x1 = (T1)E when != E = x3; when any if (...) { ... when != iounmap(...,(T2)E,...) when != if (E != NULL) { ... iounmap(...,(T2)E,...); ...} when != x2 = (T2)E ( * return; | * return ret; ) } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Vitaly Bordug <vitb@kernel.crashing.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Olof Johansson <olof@lixom.net> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 4ea426a25909..ac70d2cb7dd4 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1174,8 +1174,10 @@ static int __init m8xx_probe(struct of_device *ofdev,
1174 1174
1175 pcmcia_schlvl = irq_of_parse_and_map(np, 0); 1175 pcmcia_schlvl = irq_of_parse_and_map(np, 0);
1176 hwirq = irq_map[pcmcia_schlvl].hwirq; 1176 hwirq = irq_map[pcmcia_schlvl].hwirq;
1177 if (pcmcia_schlvl < 0) 1177 if (pcmcia_schlvl < 0) {
1178 iounmap(pcmcia);
1178 return -EINVAL; 1179 return -EINVAL;
1180 }
1179 1181
1180 m8xx_pgcrx[0] = &pcmcia->pcmc_pgcra; 1182 m8xx_pgcrx[0] = &pcmcia->pcmc_pgcra;
1181 m8xx_pgcrx[1] = &pcmcia->pcmc_pgcrb; 1183 m8xx_pgcrx[1] = &pcmcia->pcmc_pgcrb;
@@ -1189,6 +1191,7 @@ static int __init m8xx_probe(struct of_device *ofdev,
1189 driver_name, socket)) { 1191 driver_name, socket)) {
1190 pcmcia_error("Cannot allocate IRQ %u for SCHLVL!\n", 1192 pcmcia_error("Cannot allocate IRQ %u for SCHLVL!\n",
1191 pcmcia_schlvl); 1193 pcmcia_schlvl);
1194 iounmap(pcmcia);
1192 return -1; 1195 return -1;
1193 } 1196 }
1194 1197
@@ -1284,6 +1287,7 @@ static int m8xx_remove(struct of_device *ofdev)
1284 } 1287 }
1285 for (i = 0; i < PCMCIA_SOCKETS_NO; i++) 1288 for (i = 0; i < PCMCIA_SOCKETS_NO; i++)
1286 pcmcia_unregister_socket(&socket[i].socket); 1289 pcmcia_unregister_socket(&socket[i].socket);
1290 iounmap(pcmcia);
1287 1291
1288 free_irq(pcmcia_schlvl, NULL); 1292 free_irq(pcmcia_schlvl, NULL);
1289 1293