Skip to contentSkip to conversation

drm/vc4: plane: Remove WARN on state being set in plane_reset

PATCH Applied Stefan Wahren 3 participants 5 messages Dec 2, 2024 – Dec 11, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vc4: plane: Remove WARN on state being set in plane_reset

From: Dave Stevenson <[email protected]>

It is permitted on situations such as system resume for plane->state to be non-NULL, and that should be handled by freeing it. Do so.

---
 drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_plane.c +4 -1
index ba6e86d62a77..1aaa4938824b 100644
@@ -330,7 +330,10 @@ static void vc4_plane_reset(struct drm_plane *plane)
 {
 	struct vc4_plane_state *vc4_state;
 
-	WARN_ON(plane->state);
+	if (plane->state)
+		__drm_atomic_helper_plane_destroy_state(plane->state);
+
+	kfree(plane->state);
 
 	vc4_state = kzalloc(sizeof(*vc4_state), GFP_KERNEL);
 	if (!vc4_state)

--
2.34.1

reviewer
#2 lore raw
In reply to Stefan Wahren

Hi Stefan,

Quoted 7 lines · Stefan Wahren

From: Dave Stevenson <[email protected]>

It is permitted on situations such as system resume for plane->state to be non-NULL, and that should be handled by freeing it. Do so.

Was this patch applied? Let me know if you would like it to be applied to drm-misc-next.

Best Regards,
- Maíra

Quoted 23 lines
---
  drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_plane.c +4 -2
index ba6e86d62a77..1aaa4938824b 100644
@@ -330,7 +330,10 @@ static void vc4_plane_reset(struct drm_plane *plane)
  {
  	struct vc4_plane_state *vc4_state;
 
-	WARN_ON(plane->state);
+	if (plane->state)
+		__drm_atomic_helper_plane_destroy_state(plane->state);
+
+	kfree(plane->state);
 
  	vc4_state = kzalloc(sizeof(*vc4_state), GFP_KERNEL);
  	if (!vc4_state)
--

2.34.1

#3 lore raw

Hi Maíra,

Am 11.12.24 um 14:19 schrieb Maíra Canal:

Quoted 5 lines

Hi Stefan,

Quoted 2 lines · Stefan Wahren

From: Dave Stevenson <[email protected]>

Quoted 7 lines
Quoted 5 lines

It is permitted on situations such as system resume for plane->state to be non-NULL, and that should be handled by freeing it. Do so.

Was this patch applied?

No, but Maxime send his RB.

Quoted 2 lines

Let me know if you would like it to be applied
to drm-misc-next.

Yes, please.

Best regards

Quoted 30 lines

Best Regards,
- Maíra

Quoted 25 lines

---
  drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_plane.c +4 -1
index ba6e86d62a77..1aaa4938824b 100644
@@ -330,7 +330,10 @@ static void vc4_plane_reset(struct drm_plane
 *plane)
   {
       struct vc4_plane_state *vc4_state;
 
-    WARN_ON(plane->state);
+    if (plane->state)
+ __drm_atomic_helper_plane_destroy_state(plane->state);
+
+    kfree(plane->state);
 
       vc4_state = kzalloc(sizeof(*vc4_state), GFP_KERNEL);

      if (!vc4_state)
--
2.34.1

reviewer Applied
#4 lore raw

Hi Stefan,

Quoted 11 lines · Stefan Wahren

Hi Maíra,

Am 11.12.24 um 14:19 schrieb Maíra Canal:

Quoted 8 lines

Hi Stefan,

Quoted 5 lines · Stefan Wahren

From: Dave Stevenson <[email protected]>

It is permitted on situations such as system resume for plane->state to be non-NULL, and that should be handled by freeing it. Do so.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Was this patch applied?

No, but Maxime send his RB.

Quoted 2 lines

Let me know if you would like it to be applied
to drm-misc-next.

Yes, please.

Applied to misc/kernel.git (drm-misc-next) [1].

[1] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/c5cf801914ef3e67923e5dc912e04167e665dd11

Best Regards,
- Maíra

Quoted 33 lines

Best regards

Quoted 30 lines

Best Regards,
- Maíra

Quoted 25 lines

---
  drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_plane.c +4 -1
index ba6e86d62a77..1aaa4938824b 100644
@@ -330,7 +330,10 @@ static void vc4_plane_reset(struct drm_plane
 *plane)
   {
       struct vc4_plane_state *vc4_state;
 
-    WARN_ON(plane->state);
+    if (plane->state)
+ __drm_atomic_helper_plane_destroy_state(plane->state);
+
+    kfree(plane->state);
 
       vc4_state = kzalloc(sizeof(*vc4_state), GFP_KERNEL);

      if (!vc4_state)

Signature · 1 line
2.34.1