amifb: check fb_alloc_cmap return value and handle failure properly
PATCH 14/15 amifb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by Andres Salomon <[email protected]>
--- drivers/video/amifb.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/video/amifb.c +5 -2
@@ -2437,7 +2437,9 @@ default_chipset: goto amifb_error; } -fb_alloc_cmap (&fb_info.cmap,1 <<fb_info.var.bits_per_pixel,0 ); + err =fb_alloc_cmap (&fb_info.cmap,1 <<fb_info.var.bits_per_pixel,0 ); +if (err) + goto amifb_error;if (register_framebuffer (&fb_info) <0 ) { err = -EINVAL ;
@@ -2456,7 +2458,8 @@ amifb_error:static void amifb_deinit (void ) { -fb_dealloc_cmap (&fb_info.cmap); +if (fb_info.cmap.len) +fb_dealloc_cmap (&fb_info.cmap);chipfree ();if (videomemory)iounmap ((void *)videomemory);
Signature · 9 lines
1.5.6.5 ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
Quoted 3 lines · On Sat, 7 Feb 2009 12:18:57 -0500 Andres Salomon <[email protected]> wrote:
Signed-off-by Andres Salomon <[email protected]>---
Acked-by Krzysztof Helt <[email protected]>
One comment below.
Quoted 19 lines
drivers/video/amifb.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)drivers/video/amifb.c +3
-1@@ -2437,7 +2437,9 @@ default_chipset: goto amifb_error; } -fb_alloc_cmap (&fb_info.cmap,1 <<fb_info.var.bits_per_pixel,0 ); + err =fb_alloc_cmap (&fb_info.cmap,1 <<fb_info.var.bits_per_pixel,0 ); +if (err) + goto amifb_error;if (register_framebuffer (&fb_info) <0 ) { err = -EINVAL ;
drivers/video/amifb.c amifb_error: · line 2462
Quoted 6 lines
drivers/video/amifb.c +2
-1@@ -2456,7 +2458,8 @@ amifb_error:static void amifb_deinit (void ) { -fb_dealloc_cmap (&fb_info.cmap); +if (fb_info.cmap.len) +fb_dealloc_cmap (&fb_info.cmap);
Again, is the "if(fb_info.cmap.len)" needed here?
Quoted 6 lines
drivers/video/amifb.c +0
-0chipfree ();if (videomemory)iounmap ((void *)videomemory);Signature · 1 line
1.5.6.5
Quoted 10 lines · On Mon, 9 Feb 2009 21:26:29 +0100 Krzysztof Helt <[email protected]> wrote:
Quoted 3 lines · On Sat, 7 Feb 2009 12:18:57 -0500 Andres Salomon <[email protected]> wrote:
Signed-off-by Andres Salomon <[email protected]>---
Acked-by Krzysztof Helt <[email protected]>One comment below.
[...]
Quoted 9 lines
drivers/video/amifb.c amifb_error: · line 2462
Quoted 7 lines
drivers/video/amifb.c +2
-1@@ -2456,7 +2458,8 @@ amifb_error:static void amifb_deinit (void ) { -fb_dealloc_cmap (&fb_info.cmap); +if (fb_info.cmap.len) +fb_dealloc_cmap (&fb_info.cmap);Again, is the "
if(fb_info.cmap.len)" needed here?
Yep; amifb_deinit is called from amifb_init in the case of errors. This can happen before fb_alloc_cmap is called (but after the memory region has been requested), so we need to explicitly check that cmap memory has been allocated.