Merge tag 'mediatek-drm-fixes-5.16' of https://git.kernel.org/pub/scm/linux/kernel...
authorDave Airlie <airlied@redhat.com>
Thu, 23 Dec 2021 00:54:58 +0000 (10:54 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 23 Dec 2021 00:55:04 +0000 (10:55 +1000)
Mediatek DRM Fixes for Linux 5.16

1. Perform NULL pointer check for mtk_hdmi_conf.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1639956861-14873-1-git-send-email-chunkuang.hu@kernel.org
drivers/gpu/drm/mediatek/mtk_hdmi.c

index 5838c44..3196189 100644 (file)
@@ -1224,12 +1224,14 @@ static int mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
                        return MODE_BAD;
        }
 
-       if (hdmi->conf->cea_modes_only && !drm_match_cea_mode(mode))
-               return MODE_BAD;
+       if (hdmi->conf) {
+               if (hdmi->conf->cea_modes_only && !drm_match_cea_mode(mode))
+                       return MODE_BAD;
 
-       if (hdmi->conf->max_mode_clock &&
-           mode->clock > hdmi->conf->max_mode_clock)
-               return MODE_CLOCK_HIGH;
+               if (hdmi->conf->max_mode_clock &&
+                   mode->clock > hdmi->conf->max_mode_clock)
+                       return MODE_CLOCK_HIGH;
+       }
 
        if (mode->clock < 27000)
                return MODE_CLOCK_LOW;