diff mbox series

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

Message ID 20241202120343.33726-1-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series drm/vc4: plane: Remove WARN on state being set in plane_reset | expand

Commit Message

Stefan Wahren Dec. 2, 2024, 12:03 p.m. UTC
From: Dave Stevenson <dave.stevenson@raspberrypi.com>

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.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--
2.34.1

Comments

Maxime Ripard Dec. 2, 2024, 12:17 p.m. UTC | #1
On Mon, 2 Dec 2024 13:03:43 +0100, Stefan Wahren wrote:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> 
> 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.
> 
> 
> [ ... ]

Reviewed-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime
Maíra Canal Dec. 11, 2024, 1:19 p.m. UTC | #2
Hi Stefan,

On 02/12/24 09:03, Stefan Wahren wrote:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> 
> 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.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

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

Best Regards,
- Maíra

> ---
>   drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
> index ba6e86d62a77..1aaa4938824b 100644
> --- a/drivers/gpu/drm/vc4/vc4_plane.c
> +++ b/drivers/gpu/drm/vc4/vc4_plane.c
> @@ -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
>
Stefan Wahren Dec. 11, 2024, 2:07 p.m. UTC | #3
Hi Maíra,

Am 11.12.24 um 14:19 schrieb Maíra Canal:
> Hi Stefan,
>
> On 02/12/24 09:03, Stefan Wahren wrote:
>> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
>>
>> 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.
>>
>> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>
> Was this patch applied?
No, but Maxime send his RB.
> Let me know if you would like it to be applied
> to drm-misc-next.
Yes, please.

Best regards
>
> Best Regards,
> - Maíra
>
>> ---
>>   drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/vc4/vc4_plane.c
>> b/drivers/gpu/drm/vc4/vc4_plane.c
>> index ba6e86d62a77..1aaa4938824b 100644
>> --- a/drivers/gpu/drm/vc4/vc4_plane.c
>> +++ b/drivers/gpu/drm/vc4/vc4_plane.c
>> @@ -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
>>
>
Maíra Canal Dec. 11, 2024, 2:51 p.m. UTC | #4
Hi Stefan,

On 11/12/24 11:07, Stefan Wahren wrote:
> Hi Maíra,
> 
> Am 11.12.24 um 14:19 schrieb Maíra Canal:
>> Hi Stefan,
>>
>> On 02/12/24 09:03, Stefan Wahren wrote:
>>> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
>>>
>>> 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.
>>>
>>> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>>
>> Was this patch applied?
> No, but Maxime send his RB.
>> 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

> 
> Best regards
>>
>> Best Regards,
>> - Maíra
>>
>>> ---
>>>   drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/vc4/vc4_plane.c
>>> b/drivers/gpu/drm/vc4/vc4_plane.c
>>> index ba6e86d62a77..1aaa4938824b 100644
>>> --- a/drivers/gpu/drm/vc4/vc4_plane.c
>>> +++ b/drivers/gpu/drm/vc4/vc4_plane.c
>>> @@ -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
>>>
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index ba6e86d62a77..1aaa4938824b 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -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)