Skip to content
Permalink
Browse files
staging: androind: Replace BUG_ONs with WARN_ONs
BUG_ON() is replaced with WARN_ON at ion_page_pool.c
Fixes the following issue:
Avoid crashing the kernel - try using WARN_ON & recovery code ratherthan BUG() or BUG_ON().

Signed-off-by: Tomer Samara <tomersamara98@gmail.com>
  • Loading branch information
TomerSamara98 authored and intel-lab-lkp committed Aug 16, 2020
1 parent 86cfccb commit 71d27df2e46fe435ada18ac3dae964d6b9a74664
Showing 1 changed file with 8 additions and 4 deletions.
@@ -46,11 +46,13 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
struct page *page;

if (high) {
BUG_ON(!pool->high_count);
if (WARN_ON(!pool->high_count))
return NULL:
page = list_first_entry(&pool->high_items, struct page, lru);
pool->high_count--;
} else {
BUG_ON(!pool->low_count);
if (WARN_ON(!pool->low_count))
return NULL;
page = list_first_entry(&pool->low_items, struct page, lru);
pool->low_count--;
}
@@ -65,7 +67,8 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
{
struct page *page = NULL;

BUG_ON(!pool);
if (WARN_ON(!pool))
return NULL;

mutex_lock(&pool->mutex);
if (pool->high_count)
@@ -82,7 +85,8 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)

void ion_page_pool_free(struct ion_page_pool *pool, struct page *page)
{
BUG_ON(pool->order != compound_order(page));
if (WARN_ON(pool->order != compound_order(page)))
return;

ion_page_pool_add(pool, page);
}

0 comments on commit 71d27df

Please sign in to comment.