From 2bfb4627580ae91d2978e1c071ed1a4b5039f2fd Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Tue, 21 Apr 2015 17:13:20 +0300 Subject: [PATCH] drm/i915: Take ownership of atomic state on success in intel_set_mode() To match the behavior of ->atomic_commit(). Signed-off-by: Ander Conselvan de Oliveira Reviewed-by: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index db450772b4a5..e3e4a04a18bf 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9968,9 +9968,9 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, if (ret) goto fail; - intel_set_mode(crtc, state); - - drm_atomic_state_free(state); + ret = intel_set_mode(crtc, state); + if (ret) + goto fail; if (old->release_fb) { drm_framebuffer_unregister_private(old->release_fb); @@ -12425,6 +12425,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, intel_crtc->config = crtc_state_copy; intel_crtc->base.state = &crtc_state_copy->base; + drm_atomic_state_free(state); + return 0; } @@ -12470,6 +12472,7 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc) struct intel_connector *connector; struct drm_connector_state *connector_state; struct intel_crtc_state *crtc_state; + int ret; state = drm_atomic_state_alloc(dev); if (!state) { @@ -12528,9 +12531,9 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc) intel_modeset_setup_plane_state(state, crtc, &crtc->mode, crtc->primary->fb, crtc->x, crtc->y); - intel_set_mode(crtc, state); - - drm_atomic_state_free(state); + ret = intel_set_mode(crtc, state); + if (ret) + drm_atomic_state_free(state); } #undef for_each_intel_crtc_masked @@ -12759,7 +12762,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set) } out: - drm_atomic_state_free(state); + if (ret) + drm_atomic_state_free(state); return ret; } -- 2.34.1