mtd: onenand: samsung: add missing iounmap
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 12 Jan 2012 09:55:05 +0000 (10:55 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 26 Mar 2012 23:11:20 +0000 (00:11 +0100)
Add missing iounmap in error handling code, in a case where the function
already preforms iounmap on some other execution path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e;
statement S,S1;
int ret;
@@
e = \(ioremap\|ioremap_nocache\)(...)
... when != iounmap(e)
if (<+...e...+>) S
... when any
    when != iounmap(e)
*if (...)
   { ... when != iounmap(e)
     return ...; }
... when any
iounmap(e);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/onenand/samsung.c

index fa1ee43f735b5bb8ec97d5c6861525f8c4b5757c..deaf7628773fa694c79b2d68769ff6e89054f6d0 100644 (file)
@@ -923,7 +923,7 @@ static int s3c_onenand_probe(struct platform_device *pdev)
                r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
                if (!r) {
                        dev_err(&pdev->dev, "no buffer memory resource defined\n");
-                       return -ENOENT;
+                       err = -ENOENT;
                        goto ahb_resource_failed;
                }
 
@@ -964,7 +964,7 @@ static int s3c_onenand_probe(struct platform_device *pdev)
                r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
                if (!r) {
                        dev_err(&pdev->dev, "no dma memory resource defined\n");
-                       return -ENOENT;
+                       err = -ENOENT;
                        goto dma_resource_failed;
                }