public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set
@ 2015-07-02  7:23 Daniel Vetter
  2015-07-02  7:29 ` Daniel Vetter
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Daniel Vetter @ 2015-07-02  7:23 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Stone, Daniel Vetter, Intel Graphics Development,
	Daniel Vetter, John Hunter

In

commit 9f658b7b62e7aefc1ee067136126eca3f58cabfd
Author: Daniel Stone <daniels@collabora.com>
Date:   Fri May 22 13:34:45 2015 +0100

    drm/crtc_helper: Replace open-coded CRTC state helpers

error handling code was broken, resulting in the first path not being
checked correctly. Fix this by using the same pattern as in the
transitional plane helper function drm_plane_helper_update.

Cc: Daniel Stone <daniels@collabora.com>
CC: Sean Paul <seanpaul@chromium.org>
Cc: John Hunter <zhaojunwang@pku.edu.cn>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 393114df88a3..0035c3395b30 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -927,15 +927,13 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod
 
 	if (crtc->funcs->atomic_duplicate_state)
 		crtc_state = crtc->funcs->atomic_duplicate_state(crtc);
-	else {
+	else if (crtc->state)
+		crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);
+	else
 		crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
-		if (!crtc_state)
-			return -ENOMEM;
-		if (crtc->state)
-			__drm_atomic_helper_crtc_duplicate_state(crtc, crtc_state);
-		else
-			crtc_state->crtc = crtc;
-	}
+
+	if (!crtc_state)
+		return -ENOMEM;
 
 	crtc_state->planes_changed = true;
 	crtc_state->mode_changed = true;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-07-04 19:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02  7:23 [PATCH] drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set Daniel Vetter
2015-07-02  7:29 ` Daniel Vetter
2015-07-02  9:01 ` Daniel Stone
2015-07-02 13:16 ` Daniel Vetter
2015-07-02 13:27   ` Daniel Stone
2015-07-02 14:29     ` Daniel Vetter
2015-07-02 14:33     ` [PATCH] drm: reset empty state in transitional helpers Daniel Vetter
2015-07-02 14:39       ` John Hunter
2015-07-03  7:10       ` Daniel Stone
2015-07-02 14:40   ` [PATCH] drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set John Hunter
2015-07-04 16:57   ` shuang.he
2015-07-02 14:00 ` [PATCH 1/2] " Daniel Vetter
2015-07-02 14:00   ` [PATCH 2/2] drm/plane-helper: Use init state when freshly allocating them Daniel Vetter
2015-07-04 19:11     ` shuang.he
2015-07-04 10:39 ` [PATCH] drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set shuang.he

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox