diff --git a/drivers/amlogic/drm/am_meson_fbdev.c b/drivers/amlogic/drm/am_meson_fbdev.c index 610f3ca7f3dfa1..c0162ae9bb5ea9 100644 --- a/drivers/amlogic/drm/am_meson_fbdev.c +++ b/drivers/amlogic/drm/am_meson_fbdev.c @@ -83,6 +83,7 @@ static int am_meson_drm_fbdev_create(struct drm_fb_helper *helper, struct fb_info *fbi; size_t size; int ret; + void* vaddr; bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8); @@ -101,6 +102,12 @@ static int am_meson_drm_fbdev_create(struct drm_fb_helper *helper, private->fbdev_bo = &meson_obj->base; + vaddr = ion_map_kernel(client, meson_obj->handle); + if (!vaddr) { + ret = -ENOMEM; + goto err_meson_gem_free_object; + } + fbi = drm_fb_helper_alloc_fbi(helper); if (IS_ERR(fbi)) { dev_err(dev->dev, "Failed to create framebuffer info.\n"); @@ -119,8 +126,17 @@ static int am_meson_drm_fbdev_create(struct drm_fb_helper *helper, fbi->par = helper; fbi->flags = FBINFO_FLAG_DEFAULT; fbi->fbops = &meson_drm_fbdev_ops; + fbi->screen_size = size; + fbi->fix.smem_len = fbi->screen_size; + fbi->screen_buffer = vaddr; + /* Shamelessly leak the physical address to user-space */ + fbi->fix.smem_start = + page_to_phys(virt_to_page(fbi->screen_buffer)); fb = helper->fb; + fb->bits_per_pixel = sizes->surface_bpp; + fb->depth = sizes->surface_depth; + drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height); @@ -195,7 +211,7 @@ int am_meson_drm_fbdev_init(struct drm_device *dev) err_drm_fb_helper_fini: drm_fb_helper_fini(helper); err_free: - kfree(fbdev_cma); + kfree(helper); return ret; } diff --git a/drivers/amlogic/media/vout/vout_serve/vout_serve.c b/drivers/amlogic/media/vout/vout_serve/vout_serve.c index dc897893337e27..e1d7c1e057cd10 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout_serve.c +++ b/drivers/amlogic/media/vout/vout_serve/vout_serve.c @@ -151,6 +151,11 @@ static enum vmode_e nulldisp_validate_vmode(char *name) enum vmode_e vmode = VMODE_MAX; int i; + if (!name) { + printk(KERN_ALERT "nulldisp_validate_vmode: name=NULL\n"); + return VMODE_HDMI; + } + for (i = 0; i < ARRAY_SIZE(nulldisp_vinfo); i++) { if (strcmp(nulldisp_vinfo[i].name, name) == 0) { vmode = nulldisp_vinfo[i].mode;