Re: [PATCH v4 1/2] staging: android: Remove BUG_ON from ion_page_pool.c

2020-08-24 Thread Dan Carpenter
On Fri, Aug 21, 2020 at 06:27:37PM +0300, Tomer Samara wrote:
> BUG_ON() is removed 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 
> ---

You should put a note here about what changed between v3 vs v4. Like so:
---
v4: Just remove the BUG_ON()s instead of adding new returns.
v3: Hand the new return paths or whatever.

Anyway, looks good.

Reviewed-by: Dan Carpenter 

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 1/2] staging: android: Remove BUG_ON from ion_page_pool.c

2020-08-21 Thread Tomer Samara
BUG_ON() is removed 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 
---
 drivers/staging/android/ion/ion_page_pool.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index 0198b886d906..a3ed3bfd47ee 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -46,11 +46,9 @@ static struct page *ion_page_pool_remove(struct 
ion_page_pool *pool, bool high)
struct page *page;
 
if (high) {
-   BUG_ON(!pool->high_count);
page = list_first_entry(>high_items, struct page, lru);
pool->high_count--;
} else {
-   BUG_ON(!pool->low_count);
page = list_first_entry(>low_items, struct page, lru);
pool->low_count--;
}
@@ -65,8 +63,6 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
 {
struct page *page = NULL;
 
-   BUG_ON(!pool);
-
mutex_lock(>mutex);
if (pool->high_count)
page = ion_page_pool_remove(pool, true);
@@ -82,7 +78,7 @@ 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));
+   WARN_ON(pool->order != compound_order(page))
 
ion_page_pool_add(pool, page);
 }
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel