diff options
| author | Jani Nikula <jani.nikula@intel.com> | 2012-11-12 11:31:35 -0500 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-11-12 14:12:49 -0500 |
| commit | d0ddfbd3d1346c1f481ec2289eef350cdba64b42 (patch) | |
| tree | 9ff9b2d4704bfa11520a61010ebcd14a4424c9dd | |
| parent | 4a8dece21eea0ad6aca442272673d48693cd93b4 (diff) | |
drm/i915/sdvo: clean up connectors on intel_sdvo_init() failures
Any failures in intel_sdvo_init() after the intel_sdvo_setup_output() call
left behind ghost connectors, attached (with a dangling pointer) to the
sdvo that has been cleaned up and freed. Properly destroy any connectors
attached to the encoder.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=46381
CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Cc: stable@vger.kernel.org
Tested-by: bjo@nord-west.org
[danvet: added a comment to explain why we need to clean up connectors
even when sdvo_output_setup fails.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| -rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 79d308da29ff..c600fb06e25e 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
| @@ -2382,6 +2382,18 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags) | |||
| 2382 | return true; | 2382 | return true; |
| 2383 | } | 2383 | } |
| 2384 | 2384 | ||
| 2385 | static void intel_sdvo_output_cleanup(struct intel_sdvo *intel_sdvo) | ||
| 2386 | { | ||
| 2387 | struct drm_device *dev = intel_sdvo->base.base.dev; | ||
| 2388 | struct drm_connector *connector, *tmp; | ||
| 2389 | |||
| 2390 | list_for_each_entry_safe(connector, tmp, | ||
| 2391 | &dev->mode_config.connector_list, head) { | ||
| 2392 | if (intel_attached_encoder(connector) == &intel_sdvo->base) | ||
| 2393 | intel_sdvo_destroy(connector); | ||
| 2394 | } | ||
| 2395 | } | ||
| 2396 | |||
| 2385 | static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo, | 2397 | static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo, |
| 2386 | struct intel_sdvo_connector *intel_sdvo_connector, | 2398 | struct intel_sdvo_connector *intel_sdvo_connector, |
| 2387 | int type) | 2399 | int type) |
| @@ -2705,7 +2717,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) | |||
| 2705 | intel_sdvo->caps.output_flags) != true) { | 2717 | intel_sdvo->caps.output_flags) != true) { |
| 2706 | DRM_DEBUG_KMS("SDVO output failed to setup on %s\n", | 2718 | DRM_DEBUG_KMS("SDVO output failed to setup on %s\n", |
| 2707 | SDVO_NAME(intel_sdvo)); | 2719 | SDVO_NAME(intel_sdvo)); |
| 2708 | goto err; | 2720 | /* Output_setup can leave behind connectors! */ |
| 2721 | goto err_output; | ||
| 2709 | } | 2722 | } |
| 2710 | 2723 | ||
| 2711 | /* Only enable the hotplug irq if we need it, to work around noisy | 2724 | /* Only enable the hotplug irq if we need it, to work around noisy |
| @@ -2718,12 +2731,12 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) | |||
| 2718 | 2731 | ||
| 2719 | /* Set the input timing to the screen. Assume always input 0. */ | 2732 | /* Set the input timing to the screen. Assume always input 0. */ |
| 2720 | if (!intel_sdvo_set_target_input(intel_sdvo)) | 2733 | if (!intel_sdvo_set_target_input(intel_sdvo)) |
| 2721 | goto err; | 2734 | goto err_output; |
| 2722 | 2735 | ||
| 2723 | if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo, | 2736 | if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo, |
| 2724 | &intel_sdvo->pixel_clock_min, | 2737 | &intel_sdvo->pixel_clock_min, |
| 2725 | &intel_sdvo->pixel_clock_max)) | 2738 | &intel_sdvo->pixel_clock_max)) |
| 2726 | goto err; | 2739 | goto err_output; |
| 2727 | 2740 | ||
| 2728 | DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, " | 2741 | DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, " |
| 2729 | "clock range %dMHz - %dMHz, " | 2742 | "clock range %dMHz - %dMHz, " |
| @@ -2743,6 +2756,9 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) | |||
| 2743 | (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); | 2756 | (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); |
| 2744 | return true; | 2757 | return true; |
| 2745 | 2758 | ||
| 2759 | err_output: | ||
| 2760 | intel_sdvo_output_cleanup(intel_sdvo); | ||
| 2761 | |||
| 2746 | err: | 2762 | err: |
| 2747 | drm_encoder_cleanup(&intel_encoder->base); | 2763 | drm_encoder_cleanup(&intel_encoder->base); |
| 2748 | i2c_del_adapter(&intel_sdvo->ddc); | 2764 | i2c_del_adapter(&intel_sdvo->ddc); |
