[PATCH] drm/amdgpu/userq: Fix unreachable code in amdgpu_runtime_idle_check_userq()

Alex Deucher alexdeucher at gmail.com
Mon Apr 28 17:11:59 UTC 2025


On Mon, Apr 28, 2025 at 12:38 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> Changed the control flow to use break statements instead of goto to exit
> loops when a busy user queue is detected.
>
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:2751 amdgpu_runtime_idle_check_userq() warn: ignoring unreachable code.
>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index b9a1ef343c79..801603510d56 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2749,13 +2749,17 @@ static int amdgpu_runtime_idle_check_userq(struct device *dev)
>         mutex_lock(&adev->userq_mutex);
>         list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) {
>                 idr_for_each_entry(&uqm->userq_idr, queue, queue_id) {
> +                       /* Found an active user queue */
>                         ret = -EBUSY;
> -                       goto done;
> +                       break;
>                 }
> +               if (ret == -EBUSY)
> +                       /* Exit the outer loop if busyness is found */
> +                       break;
>         }
> -done:
>         mutex_unlock(&adev->userq_mutex);
>
> +       /* Return -EBUSY if any user queue was found, otherwise 0 */

I don't understand how this changes anything.

Alex

>         return ret;
>  }
>
> --
> 2.34.1
>


More information about the amd-gfx mailing list