]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/mediatek: Check if fb is null
authorYongqiang Niu <yongqiang.niu@mediatek.com>
Mon, 11 Jan 2021 07:43:44 +0000 (15:43 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Thu, 4 Feb 2021 14:52:55 +0000 (22:52 +0800)
It's possible that state->base.fb is null. Add a check before access its
format.

Fixes: 51be20ef4508 ("drm/mediatek: Turn off Alpha bit when plane format has no alpha")
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_disp_ovl.c

index 266c5c5ca280c8291526dd90192acbda083ed01e..1c295c58a5e825e37d19f18c3b44e10902c0400b 100644 (file)
@@ -291,7 +291,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
        }
 
        con = ovl_fmt_convert(ovl, fmt);
-       if (state->base.fb->format->has_alpha)
+       if (state->base.fb && state->base.fb->format->has_alpha)
                con |= OVL_CON_AEN | OVL_CON_ALPHA;
 
        if (pending->rotation & DRM_MODE_REFLECT_Y) {