video: fbdev: cobalt_lcdfb: Handle return NULL error from devm_ioremap

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 <[email protected]>
Acked-by: Yoichi Yuasa <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
This commit is contained in:
Arvind Yadav 2016-12-13 13:50:52 +05:30 • committed by Bartlomiej Zolnierkiewicz
commit 4dcd19bfab

View file

@ -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;