Commit 2bfb4627 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Daniel Vetter

drm/i915: Take ownership of atomic state on success in intel_set_mode()

To match the behavior of ->atomic_commit().
Signed-off-by: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 8c7b5ccb
...@@ -9968,9 +9968,9 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, ...@@ -9968,9 +9968,9 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
if (ret) if (ret)
goto fail; goto fail;
intel_set_mode(crtc, state); ret = intel_set_mode(crtc, state);
if (ret)
drm_atomic_state_free(state); goto fail;
if (old->release_fb) { if (old->release_fb) {
drm_framebuffer_unregister_private(old->release_fb); drm_framebuffer_unregister_private(old->release_fb);
...@@ -12425,6 +12425,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, ...@@ -12425,6 +12425,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
intel_crtc->config = crtc_state_copy; intel_crtc->config = crtc_state_copy;
intel_crtc->base.state = &crtc_state_copy->base; intel_crtc->base.state = &crtc_state_copy->base;
drm_atomic_state_free(state);
return 0; return 0;
} }
...@@ -12470,6 +12472,7 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc) ...@@ -12470,6 +12472,7 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)
struct intel_connector *connector; struct intel_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct intel_crtc_state *crtc_state; struct intel_crtc_state *crtc_state;
int ret;
state = drm_atomic_state_alloc(dev); state = drm_atomic_state_alloc(dev);
if (!state) { if (!state) {
...@@ -12528,9 +12531,9 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc) ...@@ -12528,9 +12531,9 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)
intel_modeset_setup_plane_state(state, crtc, &crtc->mode, intel_modeset_setup_plane_state(state, crtc, &crtc->mode,
crtc->primary->fb, crtc->x, crtc->y); crtc->primary->fb, crtc->x, crtc->y);
intel_set_mode(crtc, state); ret = intel_set_mode(crtc, state);
if (ret)
drm_atomic_state_free(state); drm_atomic_state_free(state);
} }
#undef for_each_intel_crtc_masked #undef for_each_intel_crtc_masked
...@@ -12759,7 +12762,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set) ...@@ -12759,7 +12762,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
} }
out: out:
drm_atomic_state_free(state); if (ret)
drm_atomic_state_free(state);
return ret; return ret;
} }
......
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