diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-05-31 08:03:17 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-01 00:59:47 -0400 |
commit | 6709887c448d1cff51b52d09763c7b834ea5f0be (patch) | |
tree | ff788832a78b04beef5f62015846c177bdc78113 | |
parent | 84e5a795228980adc6bd737765964d7afba7017e (diff) |
drm: make drm_atomic_set_mode_prop_for_crtc() more reliable
drm_atomic_set_mode_prop_for_crtc() does not clear the state->mode, so
old data may be left there when a new mode is set, possibly causing odd
issues.
This patch improves the situation by always clearing the state->mode
first.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: stable@vger.kernel.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_atomic.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 3ff1ed7b33db..c204ef32df16 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c | |||
@@ -351,6 +351,8 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, | |||
351 | drm_property_unreference_blob(state->mode_blob); | 351 | drm_property_unreference_blob(state->mode_blob); |
352 | state->mode_blob = NULL; | 352 | state->mode_blob = NULL; |
353 | 353 | ||
354 | memset(&state->mode, 0, sizeof(state->mode)); | ||
355 | |||
354 | if (blob) { | 356 | if (blob) { |
355 | if (blob->length != sizeof(struct drm_mode_modeinfo) || | 357 | if (blob->length != sizeof(struct drm_mode_modeinfo) || |
356 | drm_mode_convert_umode(&state->mode, | 358 | drm_mode_convert_umode(&state->mode, |
@@ -363,7 +365,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, | |||
363 | DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n", | 365 | DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n", |
364 | state->mode.name, state); | 366 | state->mode.name, state); |
365 | } else { | 367 | } else { |
366 | memset(&state->mode, 0, sizeof(state->mode)); | ||
367 | state->enable = false; | 368 | state->enable = false; |
368 | DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n", | 369 | DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n", |
369 | state); | 370 | state); |