Message ID | 20200622162141.279716-8-imbrenda@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Minor fixes, improvements, and cleanup | expand |
diff --git a/lib/alloc_page.h b/lib/alloc_page.h index e6a51d2..6181299 100644 --- a/lib/alloc_page.h +++ b/lib/alloc_page.h @@ -15,6 +15,6 @@ void *alloc_pages(unsigned long order); void free_page(void *page); void free_pages(void *mem, unsigned long size); void free_pages_by_order(void *mem, unsigned long order); -int get_order(size_t size); +unsigned int get_order(size_t size); #endif diff --git a/lib/alloc_page.c b/lib/alloc_page.c index 7c8461a..8769c3f 100644 --- a/lib/alloc_page.c +++ b/lib/alloc_page.c @@ -176,7 +176,7 @@ void page_alloc_ops_enable(void) alloc_ops = &page_alloc_ops; } -int get_order(size_t size) +unsigned int get_order(size_t size) { return is_power_of_2(size) ? fls(size) : fls(size) + 1; }
Since get_order never returns a negative value, it makes sense to make it return an unsigned int. The returned value will be in practice always very small, a u8 would probably also do the trick. Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> --- lib/alloc_page.h | 2 +- lib/alloc_page.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)