Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/sched: uninitialized ret in
  drm_sched_job_add_dependency_unwrapped()
--

commit dc051a66949e820e818fce4b58132d8dd22aa6c7
Author: Boris Brezillon <[email protected]>

drm/sched: Add a drm_sched_job_add_dependency_unwrapped() helper

This commit adds a helper that unwraps fence containers and registers each
contained dma_fence as an individual job dependency.

> diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
> b/drivers/gpu/drm/scheduler/sched_main.c
> index 5f123a5e39ff4..6449d74b5218d 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c

[ ... ]

> @@ -708,6 +709,34 @@ int drm_sched_job_add_dependency(struct drm_sched_job 
> *job,
>  }
>  EXPORT_SYMBOL(drm_sched_job_add_dependency);
>  
> +/**
> + * drm_sched_job_add_dependency_unwrapped - unwrap the fence (if this is a
> + * container) and add the resulting fences as job dependencies
> + * @job: scheduler job to add the dependencies to
> + * @fence: the dma_fence to add to the list of dependencies.
> + *
> + * Note that @fence is consumed in both the success and error cases.
> + *
> + * Returns:
> + * 0 on success, or an error on failing to expand the array.
> + */
> +int drm_sched_job_add_dependency_unwrapped(struct drm_sched_job *job,
> +                                        struct dma_fence *fence)
> +{
> +     struct dma_fence *inner_fence;
> +     int ret;
> +
> +     dma_fence_unwrap_for_each(inner_fence, fence) {
> +             ret = drm_sched_job_add_dependency(job, 
> dma_fence_get(inner_fence));
> +             if (ret)
> +                     break;
> +     }
> +
> +     dma_fence_put(fence);
> +     return ret;
> +}

[Severity: High]
Should ret be initialized to 0 here?

dma_fence_unwrap_for_each() calls the out-of-line function
dma_fence_unwrap_first() and checks inner_fence before entering the loop
body.  If fence is NULL or a container yields no unsignaled inner fences,
the loop body does not run and ret is returned uninitialized, which also
triggers an uninitialized variable compiler warning.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to