summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/lockless_allocator.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/lockless_allocator.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
index d8043c0b..51e26208 100644
--- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
@@ -79,10 +79,9 @@ static void nvgpu_lockless_free(struct nvgpu_allocator *a, u64 addr)
79{ 79{
80 struct nvgpu_lockless_allocator *pa = a->priv; 80 struct nvgpu_lockless_allocator *pa = a->priv;
81 int head, ret; 81 int head, ret;
82 u64 cur_idx, rem; 82 u64 cur_idx;
83 83
84 cur_idx = addr - pa->base; 84 cur_idx = addr - pa->base;
85 rem = do_div(cur_idx, pa->blk_size);
86 85
87 while (1) { 86 while (1) {
88 head = ACCESS_ONCE(pa->head); 87 head = ACCESS_ONCE(pa->head);
@@ -148,7 +147,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
148 int i; 147 int i;
149 int err; 148 int err;
150 int nr_nodes; 149 int nr_nodes;
151 u64 count, rem; 150 u64 count;
152 struct nvgpu_lockless_allocator *a; 151 struct nvgpu_lockless_allocator *a;
153 152
154 if (!blk_size) 153 if (!blk_size)
@@ -159,7 +158,6 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
159 * In order to control memory footprint, we require count < INT_MAX 158 * In order to control memory footprint, we require count < INT_MAX
160 */ 159 */
161 count = length; 160 count = length;
162 rem = do_div(count, blk_size);
163 if (!base || !count || count > INT_MAX) 161 if (!base || !count || count > INT_MAX)
164 return -EINVAL; 162 return -EINVAL;
165 163