drm/i915/dp: use drm_edid_duplicate
authorJani Nikula <jani.nikula@intel.com>
Tue, 1 Oct 2013 07:38:54 +0000 (10:38 +0300)
committerDave Airlie <airlied@redhat.com>
Wed, 9 Oct 2013 05:55:29 +0000 (15:55 +1000)
v2: duplicate intel_connector->edid, not uninitialized edid (Dave Airlie).

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i915/intel_dp.c

index 605908df95d84fb05a7a6cc7074b46ffab8441a3..3575b86ca79936a2ed6cee858c8608fd472bf808 100644 (file)
@@ -2920,19 +2920,11 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 
        /* use cached edid if we have one */
        if (intel_connector->edid) {
-               struct edid *edid;
-               int size;
-
                /* invalid edid */
                if (IS_ERR(intel_connector->edid))
                        return NULL;
 
-               size = (intel_connector->edid->extensions + 1) * EDID_LENGTH;
-               edid = kmemdup(intel_connector->edid, size, GFP_KERNEL);
-               if (!edid)
-                       return NULL;
-
-               return edid;
+               return drm_edid_duplicate(intel_connector->edid);
        }
 
        return drm_get_edid(connector, adapter);