Fix the warning issue generated at lib/xarray.c:1849. v2: keep the error handling same as before when the xalloc() call fails to store the fence_drv ref. Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c index 76f7babd7a54..bfe7d1d139d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c @@ -842,8 +842,10 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data, * have any more space left and crash. */ if (fence_drv->fence_drv_xa_ptr) { - r = xa_alloc(fence_drv->fence_drv_xa_ptr, &index, fence_drv, - xa_limit_32b, GFP_KERNEL); + xa_lock(fence_drv->fence_drv_xa_ptr); + r = __xa_alloc(fence_drv->fence_drv_xa_ptr, &index, fence_drv, + xa_limit_32b, GFP_KERNEL); + xa_unlock(fence_drv->fence_drv_xa_ptr); if (r) goto free_fences; -- 2.25.1