drm/ttm: fix access to uninitialized variable.
authorChristian König <christian.koenig@amd.com>
Mon, 7 Jun 2021 17:10:45 +0000 (19:10 +0200)
committerChristian König <christian.koenig@amd.com>
Mon, 7 Jun 2021 17:54:46 +0000 (19:54 +0200)
The resource is not allocated yet, so no chance that this will work.

Use the placement instead.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210607171152.15914-1-christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c

index 08f8797eaa7ba1410ca2d0d3704050749bd818f5..db53fecca696a56f1b5c8d3e3b5060f003edb7b7 100644 (file)
@@ -749,7 +749,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
        struct ww_acquire_ctx *ticket;
        int ret;
 
-       man = ttm_manager_type(bdev, (*mem)->mem_type);
+       man = ttm_manager_type(bdev, place->mem_type);
        ticket = dma_resv_locking_ctx(bo->base.resv);
        do {
                ret = ttm_resource_alloc(bo, place, mem);