summaryrefslogtreecommitdiff
path: root/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorAlex Xie <AlexBin.Xie@amd.com>2017-01-28 21:50:36 +0200
committerAlex Deucher <alexander.deucher@amd.com>2017-02-02 15:22:45 -0500
commit067e9a1d47a8373b3145481a70fec84ce8e76441 (patch)
treec24672d4f6f1cdada5b54be01e249a004f962ea3 /amdgpu/amdgpu_device.c
parent7a03cdf6a703911d2a8e8ab0781f1e6b88412329 (diff)
amdgpu: vamgr_32 can be a struct instead of a pointer
vamgr_32 is an integral part of amdgpu_device. We don't need to calloc and free it. This can save CPU time, reduce heap fragmentation. Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Alex Xie <AlexBin.Xie@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> [Grazvydas Ignotas: rebase, correct a typo in commit message] Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'amdgpu/amdgpu_device.c')
-rw-r--r--amdgpu/amdgpu_device.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index cad7133d..11714e47 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -131,8 +131,7 @@ static int amdgpu_get_auth(int fd, int *auth)
static void amdgpu_device_free_internal(amdgpu_device_handle dev)
{
- amdgpu_vamgr_deinit(dev->vamgr_32);
- free(dev->vamgr_32);
+ amdgpu_vamgr_deinit(&dev->vamgr_32);
amdgpu_vamgr_deinit(dev->vamgr);
free(dev->vamgr);
util_hash_table_destroy(dev->bo_flink_names);
@@ -270,10 +269,7 @@ int amdgpu_device_initialize(int fd,
if (start > 0xffffffff)
goto free_va; /* shouldn't get here */
- dev->vamgr_32 = calloc(1, sizeof(struct amdgpu_bo_va_mgr));
- if (dev->vamgr_32 == NULL)
- goto free_va;
- amdgpu_vamgr_init(dev->vamgr_32, start, max,
+ amdgpu_vamgr_init(&dev->vamgr_32, start, max,
dev->dev_info.virtual_address_alignment);
*major_version = dev->major_version;