Skip to content

Commit 6709887

Browse files
tombaairlied
authored andcommitted
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 <[email protected]> Cc: [email protected] Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent 84e5a79 commit 6709887

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/drm_atomic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
351351
drm_property_unreference_blob(state->mode_blob);
352352
state->mode_blob = NULL;
353353

354+
memset(&state->mode, 0, sizeof(state->mode));
355+
354356
if (blob) {
355357
if (blob->length != sizeof(struct drm_mode_modeinfo) ||
356358
drm_mode_convert_umode(&state->mode,
@@ -363,7 +365,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
363365
DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
364366
state->mode.name, state);
365367
} else {
366-
memset(&state->mode, 0, sizeof(state->mode));
367368
state->enable = false;
368369
DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
369370
state);

0 commit comments

Comments
 (0)