Commit 0a5d924e5954e81a905907512f8c7a1cbf81d700
Committed by
Linus Torvalds
1 parent
0fd853118d
Exists in
master
and in
7 other branches
sm501fb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff
drivers/video/sm501fb.c
... | ... | @@ -1525,7 +1525,10 @@ |
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | /* initialise and set the palette */ |
1528 | - fb_alloc_cmap(&fb->cmap, NR_PALETTE, 0); | |
1528 | + if (fb_alloc_cmap(&fb->cmap, NR_PALETTE, 0)) { | |
1529 | + dev_err(info->dev, "failed to allocate cmap memory\n"); | |
1530 | + return -ENOMEM; | |
1531 | + } | |
1529 | 1532 | fb_set_cmap(&fb->cmap, fb); |
1530 | 1533 | |
1531 | 1534 | ret = (fb->fbops->fb_check_var)(&fb->var, fb); |