Skip to content

Commit eb8972b

Browse files
dilingertorvalds
authored andcommitted
amifb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 909baf0 commit eb8972b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎drivers/video/amifb.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,9 @@ static int __init amifb_init(void)
24372437
goto amifb_error;
24382438
}
24392439

2440-
fb_alloc_cmap(&fb_info.cmap, 1<<fb_info.var.bits_per_pixel, 0);
2440+
err = fb_alloc_cmap(&fb_info.cmap, 1<<fb_info.var.bits_per_pixel, 0);
2441+
if (err)
2442+
goto amifb_error;
24412443

24422444
if (register_framebuffer(&fb_info) < 0) {
24432445
err = -EINVAL;
@@ -2456,7 +2458,8 @@ static int __init amifb_init(void)
24562458

24572459
static void amifb_deinit(void)
24582460
{
2459-
fb_dealloc_cmap(&fb_info.cmap);
2461+
if (fb_info.cmap.len)
2462+
fb_dealloc_cmap(&fb_info.cmap);
24602463
chipfree();
24612464
if (videomemory)
24622465
iounmap((void*)videomemory);

0 commit comments

Comments
 (0)