Skip to content

Commit 81b0d0e

Browse files
drm/ttm: fix missing NULL check in ttm_device_swapout
Resources about to be destructed are not tied to BOs any more. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Fixes: 6a9b028 ("drm/ttm: move the LRU into resource handling v4") Link: https://patchwork.freedesktop.org/patch/msgid/20220603104604.456991-1-christian.koenig@amd.com
1 parent 4527d47 commit 81b0d0e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/gpu/drm/ttm/ttm_device.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
156156

157157
ttm_resource_manager_for_each_res(man, &cursor, res) {
158158
struct ttm_buffer_object *bo = res->bo;
159-
uint32_t num_pages = PFN_UP(bo->base.size);
159+
uint32_t num_pages;
160160

161+
if (!bo)
162+
continue;
163+
164+
num_pages = PFN_UP(bo->base.size);
161165
ret = ttm_bo_swapout(bo, ctx, gfp_flags);
162166
/* ttm_bo_swapout has dropped the lru_lock */
163167
if (!ret)

0 commit comments

Comments
 (0)