From: Yongqiang Niu <yongqiang.niu@mediatek.com> Date: Mon, 11 Jan 2021 07:43:44 +0000 (+0800) Subject: drm/mediatek: Check if fb is null X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b1d685b6467ac0d98fc63989f71b4ca9186be5d4;p=linux.git drm/mediatek: Check if fb is null It's possible that state->base.fb is null. Add a check before access its format. Fixes: b6b1bb980ec4 ("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> --- diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 266c5c5ca280c..1c295c58a5e82 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -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) {