diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/comptags.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/comptags.c b/drivers/gpu/nvgpu/common/mm/comptags.c index 334236ec..3bde3a53 100644 --- a/drivers/gpu/nvgpu/common/mm/comptags.c +++ b/drivers/gpu/nvgpu/common/mm/comptags.c | |||
@@ -32,6 +32,10 @@ int gk20a_comptaglines_alloc(struct gk20a_comptag_allocator *allocator, | |||
32 | unsigned long addr; | 32 | unsigned long addr; |
33 | int err = 0; | 33 | int err = 0; |
34 | 34 | ||
35 | if (allocator->size == 0UL) { | ||
36 | return -EINVAL; | ||
37 | } | ||
38 | |||
35 | nvgpu_mutex_acquire(&allocator->lock); | 39 | nvgpu_mutex_acquire(&allocator->lock); |
36 | addr = bitmap_find_next_zero_area(allocator->bitmap, allocator->size, | 40 | addr = bitmap_find_next_zero_area(allocator->bitmap, allocator->size, |
37 | 0, len, 0); | 41 | 0, len, 0); |
@@ -53,6 +57,10 @@ void gk20a_comptaglines_free(struct gk20a_comptag_allocator *allocator, | |||
53 | /* number zero is reserved; bitmap base is 1 */ | 57 | /* number zero is reserved; bitmap base is 1 */ |
54 | u32 addr = offset - 1U; | 58 | u32 addr = offset - 1U; |
55 | 59 | ||
60 | if (allocator->size == 0UL) { | ||
61 | return; | ||
62 | } | ||
63 | |||
56 | WARN_ON(offset == 0U); | 64 | WARN_ON(offset == 0U); |
57 | WARN_ON(addr > allocator->size); | 65 | WARN_ON(addr > allocator->size); |
58 | WARN_ON(addr + len > allocator->size); | 66 | WARN_ON(addr + len > allocator->size); |