On Wed, Aug 19, 2020 at 10:39:34PM +0300, Tomer Samara wrote:
Remove BUG() at ion_sytem_heap.c and error handling to:
- free_buffer_page
- alloc_buffer_page
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 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index eac0632ab4e8..56d53268b82c 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();
- return -1;
}
Just delete the BUG() and put a comment that /* This is impossible. */ so that reviewers know that we never return -1.
I suspect that there are some static analysis tools which might complain about this -1 return. But those tools are pretty crap. Never change code just to make the tools happy.
regards, dan carpenter