* [PATCH v5 0/2] staging: android: Remove BUG/BUG_ON
@ 2020-08-22 19:42 Tomer Samara
2020-08-22 19:43 ` [PATCH v5 1/2] staging: android: Remove BUG_ON from ion_page_pool.c Tomer Samara
2020-08-22 19:43 ` [PATCH v5 2/2] staging: android: Remove BUG from ion_system_heap.c Tomer Samara
0 siblings, 2 replies; 3+ messages in thread
From: Tomer Samara @ 2020-08-22 19:42 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Arve Hjønnevåg, Riley Andrews, Laura Abbott,
Sumit Semwal, Todd Kjos, Martijn Coenen, Joel Fernandes,
Christian Brauner, Hridya Valsaraju, Suren Baghdasaryan, devel,
dri-devel, linux-kernel
Remove BUG/BUG_ON from androind/ion
-v5:
remove WARN_ON from ion_page_pool_free
-v4:
some changes based on Dan Carpenter review:
- Remove error check at ion_page_pool_remove (conditions are impossible)
- Remove error check at opn_page_pool_alloc
- restore WARN_ON at ion_page_pool_free
- Remove unnecessary error check at ion_page_pool_shrink
- Add /* This is impossible. */ comment at order_to_index
- Remove error handling of order_to_index
-v3:
remove WARN/WARN_ON as Gerg KH suggests
-v2:
add error check to order_to_index callers
Tomer Samara (2):
staging: android: Remove BUG_ON from ion_page_pool.c
staging: android: Remove BUG from ion_system_heap.c
drivers/staging/android/ion/ion_page_pool.c | 6 ------
drivers/staging/android/ion/ion_system_heap.c | 2 +-
2 files changed, 1 insertion(+), 7 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v5 1/2] staging: android: Remove BUG_ON from ion_page_pool.c
2020-08-22 19:42 [PATCH v5 0/2] staging: android: Remove BUG/BUG_ON Tomer Samara
@ 2020-08-22 19:43 ` Tomer Samara
2020-08-22 19:43 ` [PATCH v5 2/2] staging: android: Remove BUG from ion_system_heap.c Tomer Samara
1 sibling, 0 replies; 3+ messages in thread
From: Tomer Samara @ 2020-08-22 19:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Arve Hjønnevåg, Riley Andrews, Laura Abbott,
Sumit Semwal, Todd Kjos, Martijn Coenen, Joel Fernandes,
Christian Brauner, Hridya Valsaraju, Suren Baghdasaryan, devel,
dri-devel, linux-kernel
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 <tomersamara98@gmail.com>
---
drivers/staging/android/ion/ion_page_pool.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
index 0198b886d906..fa764299f004 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(&pool->high_items, struct page, lru);
pool->high_count--;
} else {
- BUG_ON(!pool->low_count);
page = list_first_entry(&pool->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(&pool->mutex);
if (pool->high_count)
page = ion_page_pool_remove(pool, true);
@@ -82,8 +78,6 @@ 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));
-
ion_page_pool_add(pool, page);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v5 2/2] staging: android: Remove BUG from ion_system_heap.c
2020-08-22 19:42 [PATCH v5 0/2] staging: android: Remove BUG/BUG_ON Tomer Samara
2020-08-22 19:43 ` [PATCH v5 1/2] staging: android: Remove BUG_ON from ion_page_pool.c Tomer Samara
@ 2020-08-22 19:43 ` Tomer Samara
1 sibling, 0 replies; 3+ messages in thread
From: Tomer Samara @ 2020-08-22 19:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Arve Hjønnevåg, Riley Andrews, Laura Abbott,
Sumit Semwal, Todd Kjos, Martijn Coenen, Joel Fernandes,
Christian Brauner, Hridya Valsaraju, Suren Baghdasaryan, devel,
dri-devel, linux-kernel
Remove BUG() from ion_sytem_heap.c
this fix the following checkpatch issue:
Avoid crashing the kernel - try using WARN_ON &
recovery code ratherthan BUG() or BUG_ON().
Signed-off-by: Tomer Samara <tomersamara98@gmail.com>
---
drivers/staging/android/ion/ion_system_heap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
index eac0632ab4e8..00d6154aec34 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -30,7 +30,7 @@ static int order_to_index(unsigned int order)
for (i = 0; i < NUM_ORDERS; i++)
if (order == orders[i])
return i;
- BUG();
+ /* This is impossible. */
return -1;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-22 19:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 19:42 [PATCH v5 0/2] staging: android: Remove BUG/BUG_ON Tomer Samara
2020-08-22 19:43 ` [PATCH v5 1/2] staging: android: Remove BUG_ON from ion_page_pool.c Tomer Samara
2020-08-22 19:43 ` [PATCH v5 2/2] staging: android: Remove BUG from ion_system_heap.c Tomer Samara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).