mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/gem: Handle shadow plane state allocation failure
@ 2026-08-16 16:58 Triet Hoang
  2026-08-17  6:37 ` Thomas Zimmermann
  0 siblings, 1 reply; 2+ messages in thread
From: Triet Hoang @ 2026-08-16 16:58 UTC (permalink / raw)
  To: maarten.lankhorst
  Cc: mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
	Triet Hoang

Allocate the new shadow plane state before destroying the existing
state, so that an allocation failure leaves the current state intact.

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
 drivers/gpu/drm/drm_gem_atomic_helper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_atomic_helper.c b/drivers/gpu/drm/drm_gem_atomic_helper.c
index abef865c5..24a0b9398 100644
--- a/drivers/gpu/drm/drm_gem_atomic_helper.c
+++ b/drivers/gpu/drm/drm_gem_atomic_helper.c
@@ -308,14 +308,16 @@ EXPORT_SYMBOL(__drm_gem_reset_shadow_plane);
  */
 void drm_gem_reset_shadow_plane(struct drm_plane *plane)
 {
-	struct drm_shadow_plane_state *shadow_plane_state;
+	struct drm_shadow_plane_state *shadow_plane_state = kzalloc_obj(*shadow_plane_state);
+
+	if (!shadow_plane_state)
+		return;
 
 	if (plane->state) {
 		drm_gem_destroy_shadow_plane_state(plane, plane->state);
 		plane->state = NULL; /* must be set to NULL here */
 	}
 
-	shadow_plane_state = kzalloc_obj(*shadow_plane_state);
 	__drm_gem_reset_shadow_plane(plane, shadow_plane_state);
 }
 EXPORT_SYMBOL(drm_gem_reset_shadow_plane);
-- 
2.53.0


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

end of thread, other threads:[~2026-08-17  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-16 16:58 [PATCH] drm/gem: Handle shadow plane state allocation failure Triet Hoang
2026-08-17  6:37 ` Thomas Zimmermann

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

all inboxes | Powered by JetHome®