aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_global.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2009-08-17 16:28:39 +0200
committerDave Airlie <airlied@linux.ie>2009-08-19 16:09:53 +1000
commit5fd9cbad3a4ae82c83c55b9c621d156c326724ef (patch)
tree1a0868a3bd2751fa861c083aeb3ac27f3f695694 /drivers/gpu/drm/ttm/ttm_global.c
parente9840be8c23601285a70520b4898818f28ce8c2b (diff)
drm/ttm: Memory accounting rework.
Use inclusive zones to simplify accounting and its sysfs representation. Use DMA32 accounting where applicable. Add a sysfs interface to make the heuristically determined limits readable and configurable. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_global.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_global.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_global.c b/drivers/gpu/drm/ttm/ttm_global.c
index 0b14eb1972b..541744d00d3 100644
--- a/drivers/gpu/drm/ttm/ttm_global.c
+++ b/drivers/gpu/drm/ttm/ttm_global.c
@@ -71,7 +71,7 @@ int ttm_global_item_ref(struct ttm_global_reference *ref)
mutex_lock(&item->mutex);
if (item->refcount == 0) {
- item->object = kmalloc(ref->size, GFP_KERNEL);
+ item->object = kzalloc(ref->size, GFP_KERNEL);
if (unlikely(item->object == NULL)) {
ret = -ENOMEM;
goto out_err;
@@ -89,7 +89,6 @@ int ttm_global_item_ref(struct ttm_global_reference *ref)
mutex_unlock(&item->mutex);
return 0;
out_err:
- kfree(item->object);
mutex_unlock(&item->mutex);
item->object = NULL;
return ret;
@@ -105,7 +104,6 @@ void ttm_global_item_unref(struct ttm_global_reference *ref)
BUG_ON(ref->object != item->object);
if (--item->refcount == 0) {
ref->release(ref);
- kfree(item->object);
item->object = NULL;
}
mutex_unlock(&item->mutex);