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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
index 79bf4cd6..59fae76d 100644
--- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
@@ -41,10 +41,10 @@ static u64 nvgpu_lockless_alloc_base(struct nvgpu_allocator *a)
41 return pa->base; 41 return pa->base;
42} 42}
43 43
44static int nvgpu_lockless_alloc_inited(struct nvgpu_allocator *a) 44static bool nvgpu_lockless_alloc_inited(struct nvgpu_allocator *a)
45{ 45{
46 struct nvgpu_lockless_allocator *pa = a->priv; 46 struct nvgpu_lockless_allocator *pa = a->priv;
47 int inited = pa->inited; 47 bool inited = pa->inited;
48 48
49 nvgpu_smp_rmb(); 49 nvgpu_smp_rmb();
50 return inited; 50 return inited;
@@ -169,7 +169,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *na,
169 u64 count; 169 u64 count;
170 struct nvgpu_lockless_allocator *a; 170 struct nvgpu_lockless_allocator *a;
171 171
172 if (!blk_size) { 172 if (blk_size == 0ULL) {
173 return -EINVAL; 173 return -EINVAL;
174 } 174 }
175 175
@@ -178,12 +178,12 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *na,
178 * In order to control memory footprint, we require count < INT_MAX 178 * In order to control memory footprint, we require count < INT_MAX
179 */ 179 */
180 count = length / blk_size; 180 count = length / blk_size;
181 if (!base || !count || count > INT_MAX) { 181 if (base == 0ULL || count == 0ULL || count > INT_MAX) {
182 return -EINVAL; 182 return -EINVAL;
183 } 183 }
184 184
185 a = nvgpu_kzalloc(g, sizeof(struct nvgpu_lockless_allocator)); 185 a = nvgpu_kzalloc(g, sizeof(struct nvgpu_lockless_allocator));
186 if (!a) { 186 if (a == NULL) {
187 return -ENOMEM; 187 return -ENOMEM;
188 } 188 }
189 189
@@ -193,7 +193,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *na,
193 } 193 }
194 194
195 a->next = nvgpu_vzalloc(g, sizeof(*a->next) * count); 195 a->next = nvgpu_vzalloc(g, sizeof(*a->next) * count);
196 if (!a->next) { 196 if (a->next == NULL) {
197 err = -ENOMEM; 197 err = -ENOMEM;
198 goto fail; 198 goto fail;
199 } 199 }