diff options
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_resource.c')
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_resource.c | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index 7333f7a87a2f..46ff9c75bb12 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -86,6 +86,8 @@ static void ttm_lru_bulk_move_pos_tail(struct ttm_lru_bulk_move_pos *pos,  				       struct ttm_resource *res)  {  	if (pos->last != res) { +		if (pos->first == res) +			pos->first = list_next_entry(res, lru);  		list_move(&res->lru, &pos->last->lru);  		pos->last = res;  	} @@ -111,7 +113,8 @@ static void ttm_lru_bulk_move_del(struct ttm_lru_bulk_move *bulk,  {  	struct ttm_lru_bulk_move_pos *pos = ttm_lru_bulk_move_pos(bulk, res); -	if (unlikely(pos->first == res && pos->last == res)) { +	if (unlikely(WARN_ON(!pos->first || !pos->last) || +		     (pos->first == res && pos->last == res))) {  		pos->first = NULL;  		pos->last = NULL;  	} else if (pos->first == res) { |