Skip to content

Commit

Permalink
sm501fb: check fb_alloc_cmap return value and handle failure properly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andres Salomon authored and Linus Torvalds committed Apr 1, 2009
1 parent 0fd8531 commit 0a5d924
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/video/sm501fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,10 @@ static int sm501fb_init_fb(struct fb_info *fb,
}

/* initialise and set the palette */
fb_alloc_cmap(&fb->cmap, NR_PALETTE, 0);
if (fb_alloc_cmap(&fb->cmap, NR_PALETTE, 0)) {
dev_err(info->dev, "failed to allocate cmap memory\n");
return -ENOMEM;
}
fb_set_cmap(&fb->cmap, fb);

ret = (fb->fbops->fb_check_var)(&fb->var, fb);
Expand Down

0 comments on commit 0a5d924

Please sign in to comment.