From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Mon, 19 Jan 2015 11:30:33 +0100

The iounmap() function could be called in two cases by the vesafb_probe()
function during error handling even if the passed data structure element
contained still a null pointer.

This implementation detail could be improved by adjustments for jump labels.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 drivers/video/fbdev/vesafb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
index 693d18e..de7cad0 100644
--- a/drivers/video/fbdev/vesafb.c
+++ b/drivers/video/fbdev/vesafb.c
@@ -303,7 +303,7 @@ static int vesafb_probe(struct platform_device *dev)
        info->apertures = alloc_apertures(1);
        if (!info->apertures) {
                err = -ENOMEM;
-               goto err;
+               goto release_framebuffer;
        }
        info->apertures->ranges[0].base = screen_info.lfb_base;
        info->apertures->ranges[0].size = size_total;
@@ -462,7 +462,7 @@ static int vesafb_probe(struct platform_device *dev)
                       "vesafb: abort, cannot ioremap video memory 0x%x @ 
0x%lx\n",
                        vesafb_fix.smem_len, vesafb_fix.smem_start);
                err = -EIO;
-               goto err;
+               goto release_framebuffer;
        }
 
        printk(KERN_INFO "vesafb: framebuffer at 0x%lx, mapped to 0x%p, "
@@ -492,6 +492,7 @@ static int vesafb_probe(struct platform_device *dev)
        return 0;
 err:
        iounmap(info->screen_base);
+release_framebuffer:
        framebuffer_release(info);
        release_mem_region(vesafb_fix.smem_start, size_total);
        return err;
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to