When amdgpu_userq_fence_driver_destroy walks the xarray of registered
fence drivers in order to remove itself from it, it can stop iterating
once it has found itself.

Signed-off-by: Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index 38d120c72edf..8ec7f6b65d51 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -200,8 +200,10 @@ void amdgpu_userq_fence_driver_destroy(struct kref *ref)
 
        xa_lock_irqsave(xa, flags);
        xa_for_each(xa, index, xa_fence_drv)
-               if (xa_fence_drv == fence_drv)
+               if (xa_fence_drv == fence_drv) {
                        __xa_erase(xa, index);
+                       break;
+               }
        xa_unlock_irqrestore(xa, flags);
 
        /* Free seq64 memory */
-- 
2.51.1

Reply via email to