drm/i915/hdcp: No HDCP when encoder is't initialized
authorAnshuman Gupta <anshuman.gupta@intel.com>
Mon, 11 Jan 2021 08:11:05 +0000 (13:41 +0530)
committerAnshuman Gupta <anshuman.gupta@intel.com>
Wed, 13 Jan 2021 02:59:31 +0000 (08:29 +0530)
There can be situation when DP MST connector is created without
mst modeset being done, in those cases connector->encoder will be
NULL. MST connector->encoder initializes after modeset.
Don't enable HDCP in such cases to prevent any crash.

Cc: Ramalingam C <ramalingam.c@intel.com>
Cc: Juston Li <juston.li@intel.com>
Tested-by: Karthik B S <karthik.b.s@intel.com>
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210111081120.28417-5-anshuman.gupta@intel.com
drivers/gpu/drm/i915/display/intel_hdcp.c

index b9d8825..7d63e94 100644 (file)
@@ -2106,6 +2106,12 @@ int intel_hdcp_enable(struct intel_connector *connector,
        if (!hdcp->shim)
                return -ENOENT;
 
+       if (!connector->encoder) {
+               drm_err(&dev_priv->drm, "[%s:%d] encoder is not initialized\n",
+                       connector->base.name, connector->base.base.id);
+               return -ENODEV;
+       }
+
        mutex_lock(&hdcp->mutex);
        mutex_lock(&dig_port->hdcp_mutex);
        drm_WARN_ON(&dev_priv->drm,