[PATCH 2/2] drm/plane-helper: Use init state when freshly allocating them

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jul 2 07:00:27 PDT 2015


Daniel fixed the same issue for crtc states in

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

    drm/crtc_helper: Replace open-coded CRTC state helpers

Follow suite.

Cc: Daniel Stone <daniels at collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/drm_plane_helper.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 2f0ed11024eb..cd367dde7521 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -527,8 +527,11 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 		plane_state = plane->funcs->atomic_duplicate_state(plane);
 	else if (plane->state)
 		plane_state = drm_atomic_helper_plane_duplicate_state(plane);
-	else
+	else {
 		plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
+		if (plane_state)
+			__drm_atomic_helper_plane_duplicate_state(plane, plane_state);
+	}
 	if (!plane_state)
 		return -ENOMEM;
 	plane_state->plane = plane;
@@ -574,8 +577,11 @@ int drm_plane_helper_disable(struct drm_plane *plane)
 		plane_state = plane->funcs->atomic_duplicate_state(plane);
 	else if (plane->state)
 		plane_state = drm_atomic_helper_plane_duplicate_state(plane);
-	else
+	else {
 		plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
+		if (plane_state)
+			__drm_atomic_helper_plane_duplicate_state(plane, plane_state);
+	}
 	if (!plane_state)
 		return -ENOMEM;
 	plane_state->plane = plane;
-- 
2.1.4



More information about the dri-devel mailing list