Commit b2f246a8 authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: fix the "ghost eDP" connector unwind path

Because calling intel_dp_destroy inside intel_edp_init_connector is
just wrong. This is the initialization path, so we should properly
unwind all the initialization through the whole caller stack.

On the intel_dp_destroy function we do the following:
1 - Free edid if it exists
2 - Call intel_panel_fini in case it's eDP
3 - Call drm_sysfs_connector_remove
4 - Call drm_connector_cleanup
5 - Free the connector

And here is how we unwind each specific step:
1 - No need as we still didn't assign anything
2 - No need as we still didn't call intel_panel_init
3 - Call it in the same function that called drm_sysfs_connector_add
4 - Call it in the same function that called drm_connector_init
5 - Free it in the same function that allocated it
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: default avatarZoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 16c25533
...@@ -1356,8 +1356,10 @@ void intel_ddi_init(struct drm_device *dev, enum port port) ...@@ -1356,8 +1356,10 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
intel_encoder->cloneable = false; intel_encoder->cloneable = false;
intel_encoder->hot_plug = intel_ddi_hot_plug; intel_encoder->hot_plug = intel_ddi_hot_plug;
if (!intel_dp_init_connector(intel_dig_port, dp_connector)) if (!intel_dp_init_connector(intel_dig_port, dp_connector)) {
kfree(dp_connector);
return; return;
}
if (intel_encoder->type != INTEL_OUTPUT_EDP) { if (intel_encoder->type != INTEL_OUTPUT_EDP) {
hdmi_connector = kzalloc(sizeof(struct intel_connector), hdmi_connector = kzalloc(sizeof(struct intel_connector),
......
...@@ -2987,7 +2987,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, ...@@ -2987,7 +2987,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
/* if this fails, presume the device is a ghost */ /* if this fails, presume the device is a ghost */
DRM_INFO("failed to retrieve link info, disabling eDP\n"); DRM_INFO("failed to retrieve link info, disabling eDP\n");
intel_dp_encoder_destroy(&intel_dig_port->base.base); intel_dp_encoder_destroy(&intel_dig_port->base.base);
intel_dp_destroy(connector);
return false; return false;
} }
...@@ -3146,8 +3145,11 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -3146,8 +3145,11 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
intel_dp_i2c_init(intel_dp, intel_connector, name); intel_dp_i2c_init(intel_dp, intel_connector, name);
if (!intel_edp_init_connector(intel_dp, intel_connector)) if (!intel_edp_init_connector(intel_dp, intel_connector)) {
drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector);
return false; return false;
}
intel_dp_add_properties(intel_dp, connector); intel_dp_add_properties(intel_dp, connector);
...@@ -3206,5 +3208,6 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) ...@@ -3206,5 +3208,6 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
intel_encoder->cloneable = false; intel_encoder->cloneable = false;
intel_encoder->hot_plug = intel_dp_hot_plug; intel_encoder->hot_plug = intel_dp_hot_plug;
intel_dp_init_connector(intel_dig_port, intel_connector); if (!intel_dp_init_connector(intel_dig_port, intel_connector))
kfree(intel_connector);
} }
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