mtd: physmap_of: Fix resources leak in 'of_flash_probe()'
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Sun, 6 Aug 2017 12:55:01 +0000 (14:55 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 15 Aug 2017 12:00:47 +0000 (14:00 +0200)
If 'of_flash_probe_gemini()' or 'of_flash_probe_versatile()' fail, we must
reslease some resources, as already done in all error handling paths in
this function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/maps/physmap_of_core.c

index 1343c34..b1bd4fa 100644 (file)
@@ -235,10 +235,10 @@ static int of_flash_probe(struct platform_device *dev)
 
                err = of_flash_probe_gemini(dev, dp, &info->list[i].map);
                if (err)
-                       return err;
+                       goto err_out;
                err = of_flash_probe_versatile(dev, dp, &info->list[i].map);
                if (err)
-                       return err;
+                       goto err_out;
 
                err = -ENOMEM;
                info->list[i].map.virt = ioremap(info->list[i].map.phys,