]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/amd/amdgpu: fix locking in bo creation error path
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 10 Jan 2017 19:36:56 +0000 (20:36 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
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 <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
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;
 }