Commit 3df52e58 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: hmm_bo: Rewrite free_private_pages() using pages_array helper funcs

Rewrite free_private_pages() using pages_array helper funcs.
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 2691ecc0
......@@ -623,28 +623,10 @@ static void free_pages_bulk_array(unsigned long nr_pages, struct page **page_arr
__free_pages(page_array[i], 0);
}
static void free_private_bo_pages(struct hmm_buffer_object *bo,
int free_pgnr)
static void free_private_bo_pages(struct hmm_buffer_object *bo)
{
int i, ret;
for (i = 0; i < free_pgnr; i++) {
ret = set_pages_wb(bo->pages[i], 1);
if (ret)
dev_err(atomisp_dev,
"set page to WB err ...ret = %d\n",
ret);
/*
W/A: set_pages_wb seldom return value = -EFAULT
indicate that address of page is not in valid
range(0xffff880000000000~0xffffc7ffffffffff)
then, _free_pages would panic; Do not know why page
address be valid,it maybe memory corruption by lowmemory
*/
if (!ret) {
__free_pages(bo->pages[i], 0);
}
}
set_pages_array_wb(bo->pages, bo->pgnr);
free_pages_bulk_array(bo->pgnr, bo->pages);
}
/*Allocate pages which will be used only by ISP*/
......@@ -822,7 +804,7 @@ void hmm_bo_free_pages(struct hmm_buffer_object *bo)
bo->status &= (~HMM_BO_PAGE_ALLOCED);
if (bo->type == HMM_BO_PRIVATE)
free_private_bo_pages(bo, bo->pgnr);
free_private_bo_pages(bo);
else if (bo->type == HMM_BO_USER)
free_user_pages(bo, bo->pgnr);
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment