diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2014-10-20 05:40:54 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2014-10-28 10:44:34 -0400 |
commit | e5a5fd4df21b9c4acb67e815ec949cce594860f8 (patch) | |
tree | 5b4b4f0a88d1c6cb77b876075faca9fbfa4f07d9 | |
parent | 6fa455935ab956248b165f150ec6ae9106210077 (diff) |
drm/radeon: Use drm_malloc_ab instead of kmalloc_array
Should avoid kmalloc failures due to large number of array entries.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81991
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_cs.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_vm.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 1c893447d7cd..a3e7aed7e680 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -450,7 +450,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo | |||
450 | kfree(parser->track); | 450 | kfree(parser->track); |
451 | kfree(parser->relocs); | 451 | kfree(parser->relocs); |
452 | kfree(parser->relocs_ptr); | 452 | kfree(parser->relocs_ptr); |
453 | kfree(parser->vm_bos); | 453 | drm_free_large(parser->vm_bos); |
454 | for (i = 0; i < parser->nchunks; i++) | 454 | for (i = 0; i < parser->nchunks; i++) |
455 | drm_free_large(parser->chunks[i].kdata); | 455 | drm_free_large(parser->chunks[i].kdata); |
456 | kfree(parser->chunks); | 456 | kfree(parser->chunks); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 3d17af34afa7..2456f69efd23 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -314,7 +314,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring | |||
314 | } | 314 | } |
315 | 315 | ||
316 | /* and then save the content of the ring */ | 316 | /* and then save the content of the ring */ |
317 | *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); | 317 | *data = drm_malloc_ab(size, sizeof(uint32_t)); |
318 | if (!*data) { | 318 | if (!*data) { |
319 | mutex_unlock(&rdev->ring_lock); | 319 | mutex_unlock(&rdev->ring_lock); |
320 | return 0; | 320 | return 0; |
@@ -356,7 +356,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring, | |||
356 | } | 356 | } |
357 | 357 | ||
358 | radeon_ring_unlock_commit(rdev, ring, false); | 358 | radeon_ring_unlock_commit(rdev, ring, false); |
359 | kfree(data); | 359 | drm_free_large(data); |
360 | return 0; | 360 | return 0; |
361 | } | 361 | } |
362 | 362 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 4532cc76a0a6..dfde266529e2 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -132,8 +132,8 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev, | |||
132 | struct radeon_cs_reloc *list; | 132 | struct radeon_cs_reloc *list; |
133 | unsigned i, idx; | 133 | unsigned i, idx; |
134 | 134 | ||
135 | list = kmalloc_array(vm->max_pde_used + 2, | 135 | list = drm_malloc_ab(vm->max_pde_used + 2, |
136 | sizeof(struct radeon_cs_reloc), GFP_KERNEL); | 136 | sizeof(struct radeon_cs_reloc)); |
137 | if (!list) | 137 | if (!list) |
138 | return NULL; | 138 | return NULL; |
139 | 139 | ||