diff options
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo.c')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index b67cfcaa661f..36f4b28c1b90 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -1204,6 +1204,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, | |||
1204 | (*destroy)(bo); | 1204 | (*destroy)(bo); |
1205 | else | 1205 | else |
1206 | kfree(bo); | 1206 | kfree(bo); |
1207 | ttm_mem_global_free(mem_glob, acc_size); | ||
1207 | return -EINVAL; | 1208 | return -EINVAL; |
1208 | } | 1209 | } |
1209 | bo->destroy = destroy; | 1210 | bo->destroy = destroy; |
@@ -1307,22 +1308,14 @@ int ttm_bo_create(struct ttm_bo_device *bdev, | |||
1307 | struct ttm_buffer_object **p_bo) | 1308 | struct ttm_buffer_object **p_bo) |
1308 | { | 1309 | { |
1309 | struct ttm_buffer_object *bo; | 1310 | struct ttm_buffer_object *bo; |
1310 | struct ttm_mem_global *mem_glob = bdev->glob->mem_glob; | ||
1311 | size_t acc_size; | 1311 | size_t acc_size; |
1312 | int ret; | 1312 | int ret; |
1313 | 1313 | ||
1314 | acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); | ||
1315 | ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false); | ||
1316 | if (unlikely(ret != 0)) | ||
1317 | return ret; | ||
1318 | |||
1319 | bo = kzalloc(sizeof(*bo), GFP_KERNEL); | 1314 | bo = kzalloc(sizeof(*bo), GFP_KERNEL); |
1320 | 1315 | if (unlikely(bo == NULL)) | |
1321 | if (unlikely(bo == NULL)) { | ||
1322 | ttm_mem_global_free(mem_glob, acc_size); | ||
1323 | return -ENOMEM; | 1316 | return -ENOMEM; |
1324 | } | ||
1325 | 1317 | ||
1318 | acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); | ||
1326 | ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, | 1319 | ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, |
1327 | buffer_start, interruptible, | 1320 | buffer_start, interruptible, |
1328 | persistent_swap_storage, acc_size, NULL, NULL); | 1321 | persistent_swap_storage, acc_size, NULL, NULL); |