drm/ttm: Fix accounting error when fail to get pages for pool
authorXiangliang.Yu <Xiangliang.Yu@amd.com>
Wed, 16 Aug 2017 06:25:51 +0000 (14:25 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 17 Aug 2017 20:47:44 +0000 (16:47 -0400)
When fail to get needed page for pool, need to put allocated pages
into pool. But current code has a miscalculation of allocated pages,
correct it.

Signed-off-by: Xiangliang.Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/ttm/ttm_page_alloc.c

index eeddc1e48409c87b8f45c1c44d8bdef52802a53c..8715998267730cd3db5511ce9280259854790555 100644 (file)
@@ -615,7 +615,7 @@ static void ttm_page_pool_fill_locked(struct ttm_page_pool *pool,
                } else {
                        pr_err("Failed to fill pool (%p)\n", pool);
                        /* If we have any pages left put them to the pool. */
-                       list_for_each_entry(p, &pool->list, lru) {
+                       list_for_each_entry(p, &new_pages, lru) {
                                ++cpages;
                        }
                        list_splice(&new_pages, &pool->list);