public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org, Dave Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	stable@vger.kernel.org
Subject: Re: [PATCHv2 3/4] drm: make drm_atomic_set_mode_prop_for_crtc() more reliable
Date: Tue, 31 May 2016 14:57:02 +0200	[thread overview]
Message-ID: <20160531125702.GD7231@phenom.ffwll.local> (raw)
In-Reply-To: <1464696198-5883-4-git-send-email-tomi.valkeinen@ti.com>

On Tue, May 31, 2016 at 03:03:17PM +0300, Tomi Valkeinen wrote:
> 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>

> ---
>  drivers/gpu/drm/drm_atomic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 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,
>  	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,
> @@ -363,7 +365,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);
> -- 
> 2.5.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

      reply	other threads:[~2016-05-31 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1464696198-5883-1-git-send-email-tomi.valkeinen@ti.com>
2016-05-31 12:03 ` [PATCHv2 1/4] drm: add missing drm_mode_set_crtcinfo call Tomi Valkeinen
2016-05-31 12:03 ` [PATCHv2 3/4] drm: make drm_atomic_set_mode_prop_for_crtc() more reliable Tomi Valkeinen
2016-05-31 12:57   ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160531125702.GD7231@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox