diff options
author | Julia Lawall <julia@diku.dk> | 2008-02-05 01:30:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:24 -0500 |
commit | 6d9f4c5cfb6084c16a800e8a2ca9db8d0859611c (patch) | |
tree | 37b511a68e923cc019dbe60a097d89fadf5d36a0 | |
parent | 2d33d563b1e2b4748c585e3169f46481e897c829 (diff) |
arch/cris: add a missing iounmap
An extra error handling label is needed for the case where the ioremap has
succeeded.
The problem was detected using the following semantic match
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
type T,T1,T2;
identifier E;
statement S;
expression x1,x2;
constant C;
int ret;
@@
T E;
...
* E = ioremap(...);
if (E == NULL) S
... when != iounmap(E)
when != if (E != NULL) { ... iounmap(E); ...}
when != x1 = (T1)E
if (...) {
... when != iounmap(E)
when != if (E != NULL) { ... iounmap(E); ...}
when != x2 = (T2)E
(
* return;
|
* return C;
|
* return ret;
)
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Mikael Starvik <starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/cris/arch-v32/drivers/pci/dma.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c index 66f9500fbc02..e0364654fc44 100644 --- a/arch/cris/arch-v32/drivers/pci/dma.c +++ b/arch/cris/arch-v32/drivers/pci/dma.c | |||
@@ -93,7 +93,7 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, | |||
93 | 93 | ||
94 | dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); | 94 | dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); |
95 | if (!dev->dma_mem) | 95 | if (!dev->dma_mem) |
96 | goto out; | 96 | goto iounmap_out; |
97 | dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); | 97 | dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); |
98 | if (!dev->dma_mem->bitmap) | 98 | if (!dev->dma_mem->bitmap) |
99 | goto free1_out; | 99 | goto free1_out; |
@@ -110,6 +110,8 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, | |||
110 | 110 | ||
111 | free1_out: | 111 | free1_out: |
112 | kfree(dev->dma_mem); | 112 | kfree(dev->dma_mem); |
113 | iounmap_out: | ||
114 | iounmap(mem_base); | ||
113 | out: | 115 | out: |
114 | return 0; | 116 | return 0; |
115 | } | 117 | } |