diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-05-31 15:03:17 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-07-27 09:47:35 -0700 |
commit | f956468c5b6ca1e4a1048564706b06b8fc4a79b2 (patch) | |
tree | 2abe48a01976c64c689a9c19d895871ff4b8f2b8 | |
parent | ec00d4d71abfd92d6cc3023dec46ff1428f74514 (diff) | |
download | lwn-f956468c5b6ca1e4a1048564706b06b8fc4a79b2.tar.gz lwn-f956468c5b6ca1e4a1048564706b06b8fc4a79b2.zip |
drm: make drm_atomic_set_mode_prop_for_crtc() more reliable
commit 6709887c448d1cff51b52d09763c7b834ea5f0be upstream.
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>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 aed2e3f8a1a2..6253775b8d9c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -367,6 +367,8 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, drm_property_unreference_blob(state->mode_blob); state->mode_blob = NULL; + memset(&state->mode, 0, sizeof(state->mode)); + if (blob) { if (blob->length != sizeof(struct drm_mode_modeinfo) || drm_mode_convert_umode(&state->mode, @@ -379,7 +381,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n", state->mode.name, state); } else { - memset(&state->mode, 0, sizeof(state->mode)); state->enable = false; DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n", state); |