summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_allocator.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
index fd721709..d3a9202b 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
@@ -285,6 +285,15 @@ int __gk20a_allocator_init(struct gk20a_allocator *a,
285 a->blk_size = blk_size; 285 a->blk_size = blk_size;
286 a->blk_shift = __ffs(blk_size); 286 a->blk_shift = __ffs(blk_size);
287 287
288 /*
289 * If base is 0 then modfy base to be the size of one block so that we
290 * can return errors by returning addr == 0.
291 */
292 if (a->base == 0) {
293 a->base = a->blk_size;
294 a->length -= a->blk_size;
295 }
296
288 /* blk_size must be greater than 0 and a power of 2. */ 297 /* blk_size must be greater than 0 and a power of 2. */
289 if (blk_size == 0) 298 if (blk_size == 0)
290 return -EINVAL; 299 return -EINVAL;