Skip to content

Commit

Permalink
drm/i915: Do not free the passed EDID in intel_connector_update_modes()
Browse files Browse the repository at this point in the history
The caller, not intel_connector_update_modes(), should free the edid. This
improves the reusability of intel_connector_update_modes().

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Jani Nikula authored and Daniel Vetter committed Oct 22, 2012
1 parent dd06f90 commit ebda95a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion drivers/gpu/drm/i915/intel_crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,16 @@ static int intel_crt_ddc_get_modes(struct drm_connector *connector,
struct i2c_adapter *adapter)
{
struct edid *edid;
int ret;

edid = intel_crt_get_edid(connector, adapter);
if (!edid)
return 0;

return intel_connector_update_modes(connector, edid);
ret = intel_connector_update_modes(connector, edid);
kfree(edid);

return ret;
}

static bool intel_crt_detect_ddc(struct drm_connector *connector)
Expand Down
7 changes: 5 additions & 2 deletions drivers/gpu/drm/i915/intel_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ int intel_connector_update_modes(struct drm_connector *connector,
drm_mode_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
drm_edid_to_eld(connector, edid);
kfree(edid);

return ret;
}
Expand All @@ -61,12 +60,16 @@ int intel_ddc_get_modes(struct drm_connector *connector,
struct i2c_adapter *adapter)
{
struct edid *edid;
int ret;

edid = drm_get_edid(connector, adapter);
if (!edid)
return 0;

return intel_connector_update_modes(connector, edid);
ret = intel_connector_update_modes(connector, edid);
kfree(edid);

return ret;
}

static const struct drm_prop_enum_list force_audio_names[] = {
Expand Down

0 comments on commit ebda95a

Please sign in to comment.