diff mbox

[2/7] drm/atomic: Early-exit from CRTC dup state

Message ID 1429554176-9865-3-git-send-email-daniels@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Stone April 20, 2015, 6:22 p.m. UTC
Just change an if (success) branch to if (fail) return;

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Daniel Vetter May 7, 2015, 9:05 a.m. UTC | #1
On Mon, Apr 20, 2015 at 07:22:51PM +0100, Daniel Stone wrote:
> Just change an if (success) branch to if (fail) return;
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>

I dropped this one since the code already changed a bit.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index d536817..60eb505 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1983,12 +1983,13 @@ drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc)
>  
>  	state = kmemdup(crtc->state, sizeof(*crtc->state), GFP_KERNEL);
>  
> -	if (state) {
> -		state->mode_changed = false;
> -		state->active_changed = false;
> -		state->planes_changed = false;
> -		state->event = NULL;
> -	}
> +	if (!state)
> +		return NULL;
> +
> +	state->mode_changed = false;
> +	state->active_changed = false;
> +	state->planes_changed = false;
> +	state->event = NULL;
>  
>  	return state;
>  }
> -- 
> 2.3.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index d536817..60eb505 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1983,12 +1983,13 @@  drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc)
 
 	state = kmemdup(crtc->state, sizeof(*crtc->state), GFP_KERNEL);
 
-	if (state) {
-		state->mode_changed = false;
-		state->active_changed = false;
-		state->planes_changed = false;
-		state->event = NULL;
-	}
+	if (!state)
+		return NULL;
+
+	state->mode_changed = false;
+	state->active_changed = false;
+	state->planes_changed = false;
+	state->event = NULL;
 
 	return state;
 }