[kvm-unit-tests PATCH v1 7/8] lib/alloc_page: make get_order return unsigned int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 lib/alloc_page.h | 2 +-
 lib/alloc_page.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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;
 }
-- 
2.26.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux