drm/amd/amdgpu: fix locking in bo creation error path
authorNicolai Hähnle <[email protected]>
Tue, 10 Jan 2017 19:36:56 +0000 (20:36 +0100)
committerAlex Deucher <[email protected]>
Fri, 27 Jan 2017 16:13:29 +0000 (11:13 -0500)
Unlock the resv lock only if we were the ones to lock it in the first
place.

Signed-off-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index ac6b074b8821a789be7f6993f9ce4ab12388c9c6..7aecf2667f9dfad95ee8aa1afdb4b07e37d00bfc 100644 (file)
@@ -408,7 +408,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
        return 0;
 
 fail_unreserve:
-       ww_mutex_unlock(&bo->tbo.resv->lock);
+       if (!resv)
+               ww_mutex_unlock(&bo->tbo.resv->lock);
        amdgpu_bo_unref(&bo);
        return r;
 }