aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_memory.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_memory.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index e055a3af926d..801b702566e6 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -261,8 +261,8 @@ static int ttm_mem_init_kernel_zone(struct ttm_mem_global *glob,
261 zone->used_mem = 0; 261 zone->used_mem = 0;
262 zone->glob = glob; 262 zone->glob = glob;
263 glob->zone_kernel = zone; 263 glob->zone_kernel = zone;
264 kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); 264 ret = kobject_init_and_add(
265 ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); 265 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
266 if (unlikely(ret != 0)) { 266 if (unlikely(ret != 0)) {
267 kobject_put(&zone->kobj); 267 kobject_put(&zone->kobj);
268 return ret; 268 return ret;
@@ -297,8 +297,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
297 zone->used_mem = 0; 297 zone->used_mem = 0;
298 zone->glob = glob; 298 zone->glob = glob;
299 glob->zone_highmem = zone; 299 glob->zone_highmem = zone;
300 kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); 300 ret = kobject_init_and_add(
301 ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); 301 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
302 if (unlikely(ret != 0)) { 302 if (unlikely(ret != 0)) {
303 kobject_put(&zone->kobj); 303 kobject_put(&zone->kobj);
304 return ret; 304 return ret;
@@ -344,8 +344,8 @@ static int ttm_mem_init_dma32_zone(struct ttm_mem_global *glob,
344 zone->used_mem = 0; 344 zone->used_mem = 0;
345 zone->glob = glob; 345 zone->glob = glob;
346 glob->zone_dma32 = zone; 346 glob->zone_dma32 = zone;
347 kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); 347 ret = kobject_init_and_add(
348 ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); 348 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
349 if (unlikely(ret != 0)) { 349 if (unlikely(ret != 0)) {
350 kobject_put(&zone->kobj); 350 kobject_put(&zone->kobj);
351 return ret; 351 return ret;
@@ -366,10 +366,8 @@ int ttm_mem_global_init(struct ttm_mem_global *glob)
366 glob->swap_queue = create_singlethread_workqueue("ttm_swap"); 366 glob->swap_queue = create_singlethread_workqueue("ttm_swap");
367 INIT_WORK(&glob->work, ttm_shrink_work); 367 INIT_WORK(&glob->work, ttm_shrink_work);
368 init_waitqueue_head(&glob->queue); 368 init_waitqueue_head(&glob->queue);
369 kobject_init(&glob->kobj, &ttm_mem_glob_kobj_type); 369 ret = kobject_init_and_add(
370 ret = kobject_add(&glob->kobj, 370 &glob->kobj, &ttm_mem_glob_kobj_type, ttm_get_kobj(), "memory_accounting");
371 ttm_get_kobj(),
372 "memory_accounting");
373 if (unlikely(ret != 0)) { 371 if (unlikely(ret != 0)) {
374 kobject_put(&glob->kobj); 372 kobject_put(&glob->kobj);
375 return ret; 373 return ret;