Skip to content

Commit

Permalink
video: fbdev: cobalt_lcdfb: Handle return NULL error from devm_ioremap
Browse files Browse the repository at this point in the history
Here, If devm_ioremap will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Yoichi Yuasa <yuasa@linux-mips.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
  • Loading branch information
ArvindYadavCs authored and bzolnier committed Jan 4, 2017
1 parent 04f6152 commit 4dcd19b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/video/fbdev/cobalt_lcdfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ static int cobalt_lcdfb_probe(struct platform_device *dev)
info->screen_size = resource_size(res);
info->screen_base = devm_ioremap(&dev->dev, res->start,
info->screen_size);
if (!info->screen_base) {
framebuffer_release(info);
return -ENOMEM;
}

info->fbops = &cobalt_lcd_fbops;
info->fix = cobalt_lcdfb_fix;
info->fix.smem_start = res->start;
Expand Down

0 comments on commit 4dcd19b

Please sign in to comment.