drm/panthor: Handle errors returned by drm_sched_entity_init()
Subsystems (3)
Boris Brezillon
maintainerPATCH 1/2 drm/panthor: Handle errors returned by drm_sched_entity_init()
In practice it's not going to fail because we're passing the current sanity checks done by drm_sched_entity_init(), and that's the only reason it would return an error, but better safe than sorry.
--- drivers/gpu/drm/panthor/panthor_sched.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_sched.c +2 -0
@@ -3380,6 +3380,8 @@ group_create_queue(struct panthor_group *group, drm_sched = &queue->scheduler; ret =drm_sched_entity_init (&queue->entity,0 , &drm_sched,1 ,NULL ); +if (ret) + goto err_free_queue;return queue;
Signature · 1 line
2.51.0
Boris Brezillon
maintainerPATCH 2/2 drm/panthor: Fix group_free_queue() for partially initialized queues
group_free_queue() can be called on a partially initialized queue object if something fails group_create_queue(). Make sure we don't call drm_sched_entity_destroy() on a entity that hasn't been initialized.
--- drivers/gpu/drm/panthor/panthor_sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_sched.c +2 -1
@@ -886,7 +886,8 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue *if (IS_ERR_OR_NULL (queue))return ; -drm_sched_entity_destroy (&queue->entity); +if (queue->entity.fence_context) +drm_sched_entity_destroy (&queue->entity);if (queue->scheduler.ops)drm_sched_fini (&queue->scheduler);
Signature · 1 line
2.51.0
Re: [PATCH 2/2] drm/panthor: Fix group_free_queue() for partially initialized queues
Quoted 26 lines · Boris Brezillon
group_free_queue()can be called on a partially initialized queue object if something failsgroup_create_queue(). Make sure we don't calldrm_sched_entity_destroy()on a entity that hasn't been initialized.Fixes 7d9c3442b02a ("drm/panthor: Defer scheduler entitiy destruction to queue release")Signed-off-by Boris Brezillon <[email protected]>--- drivers/gpu/drm/panthor/panthor_sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/panthor/panthor_sched.c +2
-2@@ -886,7 +886,8 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue *if (IS_ERR_OR_NULL (queue))return ; -drm_sched_entity_destroy (&queue->entity); +if (queue->entity.fence_context) +drm_sched_entity_destroy (&queue->entity);if (queue->scheduler.ops)drm_sched_fini (&queue->scheduler); --
Quoted 1 line
2.51.0
Adrian Larumbe
Quoted 6 lines · Boris Brezillon
In practice it's not going to fail because we're passing the current sanity checks done by
drm_sched_entity_init(), and that's the only reason it would return an error, but better safe than sorry.Fixes de8548813824 ("drm/panthor: Add the scheduler logical block")Signed-off-by Boris Brezillon <[email protected]>
For the whole series:
Best regards,
Liviu
Quoted 20 lines
--- drivers/gpu/drm/panthor/panthor_sched.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/panthor/panthor_sched.c +2
-0@@ -3380,6 +3380,8 @@ group_create_queue(struct panthor_group *group, drm_sched = &queue->scheduler; ret =drm_sched_entity_init (&queue->entity,0 , &drm_sched,1 ,NULL ); +if (ret) + goto err_free_queue;return queue;Signature · 1 line
2.51.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯