It has to be successful to find a relevant background framebuffer for a
foreground framebuffer. So, we should return error code if it happens
to fail.
This patch fixes the following issue reported by Coverity:
Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer fbi_tmp.
if (fbi_tmp->var.vmode & FB_VMODE_INTERLACED)
var->vmode |= FB_VMODE_INTERLACED;
else
var->vmode &= ~FB_VMODE_INTERLACED;
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
bg_yres = var->yres;
fbi_tmp = found_registered_fb(MEM_BG_SYNC, mxc_fbi->ipu_id);
- if (fbi_tmp) {
- bg_xres = fbi_tmp->var.xres;
- bg_yres = fbi_tmp->var.yres;
+ if (!fbi_tmp) {
+ dev_err(info->device,
+ "cannot find background fb for overlay fb\n");
+ return -EINVAL;
}
+ bg_xres = fbi_tmp->var.xres;
+ bg_yres = fbi_tmp->var.yres;
+
ipu_disp_get_window_pos(mxc_fbi->ipu, mxc_fbi->ipu_ch, &pos_x, &pos_y);
if ((var->xres + pos_x) > bg_xres)