Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/syncobj: separate declaration and init of __free() in
  wait_timeout
--

commit 7b5691e728edfdbf53ebabd68fe3be6523faee57
Author: Tvrtko Ursulin <[email protected]>

drm/syncobj: Use scoped cleanup for drm_syncobj_array_wait_timeout syncobjs

This commit converts the entries allocation and syncobj wait cleanup in
drm_syncobj_array_wait_timeout() to use a DEFINE_FREE() scope-managed cleanup
helper instead of goto labels.

> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index bd3f9e74e678f..7d5c4e4e29b20 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
[ ... ]
> @@ -1052,6 +1077,7 @@ static signed long 
> drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
>                                                 uint32_t *idx,
>                                                 ktime_t *deadline)
>  {
> +     struct syncobj_wait_entries cleanup __free(syncobj_wait_entries) = {};
>       struct syncobj_wait_entry *entries;
>       u64 *points __free(kvfree) = NULL;
>       struct dma_fence *fence;
> @@ -1076,6 +1102,11 @@ static signed long 
> drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
>       if (!entries)
>               return -ENOMEM;
>  
> +     /* After this the entries cleanup is fully automatic. */
> +     cleanup.syncobjs = syncobjs;
> +     cleanup.entries = entries;
> +     cleanup.count = count;

[Severity: Low]
Could cleanup be defined and initialized in a single statement right after
entries is allocated rather than declared empty at the top of the function?
Per include/linux/cleanup.h conventions, defining __free() variables at their
point of initialization preserves LIFO destruction order relative to points
and avoids running syncobj_wait_entries_free() on early returns before
entries is allocated.

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to