Commit 24d05927 authored by Daniel Vetter's avatar Daniel Vetter Committed by Chris Wilson

drm/i915: unload: fix intel dp encoder cleanup

struct intel_dp contains both struct intel_encoder at the beginning (as
it's base-class) and an i2c adapater. When initializing, the i2c adapter
gets assigned

	intel_encoder->ddc_adaptor = &intel_dp->adapter

and the generic intel_encode_destroy happily calls kfree on this pointer.
Ouch. Fix this by using a dp specific cleanup function.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent b970be7c
...@@ -1479,6 +1479,15 @@ intel_dp_destroy (struct drm_connector *connector) ...@@ -1479,6 +1479,15 @@ intel_dp_destroy (struct drm_connector *connector)
kfree(connector); kfree(connector);
} }
static void intel_dp_encoder_destroy(struct drm_encoder *encoder)
{
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
i2c_del_adapter(&intel_dp->adapter);
drm_encoder_cleanup(encoder);
kfree(intel_dp);
}
static const struct drm_encoder_helper_funcs intel_dp_helper_funcs = { static const struct drm_encoder_helper_funcs intel_dp_helper_funcs = {
.dpms = intel_dp_dpms, .dpms = intel_dp_dpms,
.mode_fixup = intel_dp_mode_fixup, .mode_fixup = intel_dp_mode_fixup,
...@@ -1501,7 +1510,7 @@ static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = ...@@ -1501,7 +1510,7 @@ static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs =
}; };
static const struct drm_encoder_funcs intel_dp_enc_funcs = { static const struct drm_encoder_funcs intel_dp_enc_funcs = {
.destroy = intel_encoder_destroy, .destroy = intel_dp_encoder_destroy,
}; };
void void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment