mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: allocator: release semaphore on error
Release rw_sema properly when block allocator runs out of memory and returns error. Change-Id: I6b7cf9564ae25ad1ba30edfcb1ae8a20cf7dc9db Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/601792 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Dan Willemsen
parent
0cc118c08c
commit
59339b4fd9
@@ -89,8 +89,10 @@ int gk20a_allocator_block_alloc(struct gk20a_allocator *allocator,
|
||||
len,
|
||||
allocator->align - 1);
|
||||
if ((_addr > allocator->limit - allocator->base + 1) ||
|
||||
(*addr && *addr != (_addr + allocator->base)))
|
||||
(*addr && *addr != (_addr + allocator->base))) {
|
||||
up_write(&allocator->rw_sema);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
bitmap_set(allocator->bitmap, _addr, len);
|
||||
*addr = allocator->base + _addr;
|
||||
|
||||
Reference in New Issue
Block a user