Commit c23124277e58998703278c26c53b159cea0f9643
Committed by
Linus Torvalds
1 parent
0a5d924e59
Exists in
master
and in
7 other branches
sstfb: 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff
drivers/video/sstfb.c
... | ... | @@ -1421,13 +1421,16 @@ |
1421 | 1421 | goto fail; |
1422 | 1422 | } |
1423 | 1423 | |
1424 | - fb_alloc_cmap(&info->cmap, 256, 0); | |
1424 | + if (fb_alloc_cmap(&info->cmap, 256, 0)) { | |
1425 | + printk(KERN_ERR "sstfb: can't alloc cmap memory.\n"); | |
1426 | + goto fail; | |
1427 | + } | |
1425 | 1428 | |
1426 | 1429 | /* register fb */ |
1427 | 1430 | info->device = &pdev->dev; |
1428 | 1431 | if (register_framebuffer(info) < 0) { |
1429 | 1432 | printk(KERN_ERR "sstfb: can't register framebuffer.\n"); |
1430 | - goto fail; | |
1433 | + goto fail_register; | |
1431 | 1434 | } |
1432 | 1435 | |
1433 | 1436 | sstfb_clear_screen(info); |
1434 | 1437 | |
... | ... | @@ -1441,8 +1444,9 @@ |
1441 | 1444 | |
1442 | 1445 | return 0; |
1443 | 1446 | |
1444 | -fail: | |
1447 | +fail_register: | |
1445 | 1448 | fb_dealloc_cmap(&info->cmap); |
1449 | +fail: | |
1446 | 1450 | iounmap(info->screen_base); |
1447 | 1451 | fail_fb_remap: |
1448 | 1452 | iounmap(par->mmio_vbase); |