drm: make drm_mm_init() return void
authorDavid Herrmann <dh.herrmann@gmail.com>
Mon, 1 Jul 2013 18:32:58 +0000 (20:32 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 2 Jul 2013 03:34:41 +0000 (13:34 +1000)
There is no reason to return "int" as this function never fails.
Furthermore, several drivers (ast, sis) already depend on this.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_mm.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_manager.c
include/drm/drm_mm.h

index bcedaf7b73b9a57cf53094396a9d1718a6abb2b9..603f256152efed25852072a49f32b11c7ddf16cd 100644 (file)
@@ -108,12 +108,8 @@ drm_gem_init(struct drm_device *dev)
                return -ENOMEM;
        }
 
-       if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START,
-                       DRM_FILE_PAGE_OFFSET_SIZE)) {
-               drm_ht_remove(&mm->offset_hash);
-               kfree(mm);
-               return -ENOMEM;
-       }
+       drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START,
+                   DRM_FILE_PAGE_OFFSET_SIZE);
 
        return 0;
 }
index 07cf99cc886283aedf9feee690d71ee6fbe2fb77..7917729ee61d070293c4c2b186eb6c6a5ac907e9 100644 (file)
@@ -669,7 +669,7 @@ int drm_mm_clean(struct drm_mm * mm)
 }
 EXPORT_SYMBOL(drm_mm_clean);
 
-int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
+void drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
 {
        INIT_LIST_HEAD(&mm->hole_stack);
        INIT_LIST_HEAD(&mm->unused_nodes);
@@ -690,8 +690,6 @@ int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
        list_add_tail(&mm->head_node.hole_stack, &mm->hole_stack);
 
        mm->color_adjust = NULL;
-
-       return 0;
 }
 EXPORT_SYMBOL(drm_mm_init);
 
index 6e6975c8596f39245d6158bd70d265d08cfe5e45..cb9dd674670c97f188bd0fa1eb765c97d4f62f8e 100644 (file)
@@ -1455,9 +1455,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
                goto out_no_sys;
 
        bdev->addr_space_rb = RB_ROOT;
-       ret = drm_mm_init(&bdev->addr_space_mm, file_page_offset, 0x10000000);
-       if (unlikely(ret != 0))
-               goto out_no_addr_mm;
+       drm_mm_init(&bdev->addr_space_mm, file_page_offset, 0x10000000);
 
        INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue);
        INIT_LIST_HEAD(&bdev->ddestroy);
@@ -1471,8 +1469,6 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
        mutex_unlock(&glob->device_list_mutex);
 
        return 0;
-out_no_addr_mm:
-       ttm_bo_clean_mm(bdev, 0);
 out_no_sys:
        return ret;
 }
index 9212494e9072076aa0582033a08520015f662a86..e4367f91472a4d3e25341ad4fa3e2121724a2c99 100644 (file)
@@ -103,18 +103,12 @@ static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
                           unsigned long p_size)
 {
        struct ttm_range_manager *rman;
-       int ret;
 
        rman = kzalloc(sizeof(*rman), GFP_KERNEL);
        if (!rman)
                return -ENOMEM;
 
-       ret = drm_mm_init(&rman->mm, 0, p_size);
-       if (ret) {
-               kfree(rman);
-               return ret;
-       }
-
+       drm_mm_init(&rman->mm, 0, p_size);
        spin_lock_init(&rman->lock);
        man->priv = rman;
        return 0;
index 88591ef8fa24f0cf8653a278d6bed086279691f0..de9242542f05e5279e8aa1a662d31deb9c1d33ac 100644 (file)
@@ -275,9 +275,9 @@ static inline  struct drm_mm_node *drm_mm_search_free_in_range_color(
        return drm_mm_search_free_in_range_generic(mm, size, alignment, color,
                                                   start, end, best_match);
 }
-extern int drm_mm_init(struct drm_mm *mm,
-                      unsigned long start,
-                      unsigned long size);
+extern void drm_mm_init(struct drm_mm *mm,
+                       unsigned long start,
+                       unsigned long size);
 extern void drm_mm_takedown(struct drm_mm *mm);
 extern int drm_mm_clean(struct drm_mm *mm);
 extern int drm_mm_pre_get(struct drm_mm *mm);