lmb: Fix lmb_add_region_flags() return codes and testing
The function description says this should return 0 or -1 on failures. When regions coalesce though this returns the number of coalescedregions which is confusing and requires special handling of the return code. On top of that no one is using the number of coalesced regions. So let's just return 0 on success and adjust our selftests accordingly Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
This commit is contained in:
committed by
Tom Rini
parent
92e75ee47f
commit
0f57b009e6
@@ -473,7 +473,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
|
||||
|
||||
/* allocate overlapping region should return the coalesced count */
|
||||
ret = lmb_reserve(0x40011000, 0x10000);
|
||||
ut_asserteq(ret, 1);
|
||||
ut_asserteq(ret, 0);
|
||||
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40010000, 0x11000,
|
||||
0, 0, 0, 0);
|
||||
/* allocate 3nd region */
|
||||
@@ -748,13 +748,13 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
|
||||
|
||||
/* merge after */
|
||||
ret = lmb_reserve_flags(0x40020000, 0x10000, LMB_NOMAP);
|
||||
ut_asserteq(ret, 1);
|
||||
ut_asserteq(ret, 0);
|
||||
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40010000, 0x20000,
|
||||
0, 0, 0, 0);
|
||||
|
||||
/* merge before */
|
||||
ret = lmb_reserve_flags(0x40000000, 0x10000, LMB_NOMAP);
|
||||
ut_asserteq(ret, 1);
|
||||
ut_asserteq(ret, 0);
|
||||
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40000000, 0x30000,
|
||||
0, 0, 0, 0);
|
||||
|
||||
@@ -770,7 +770,7 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
|
||||
|
||||
/* test that old API use LMB_NONE */
|
||||
ret = lmb_reserve(0x40040000, 0x10000);
|
||||
ut_asserteq(ret, 1);
|
||||
ut_asserteq(ret, 0);
|
||||
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 2, 0x40000000, 0x30000,
|
||||
0x40030000, 0x20000, 0, 0);
|
||||
|
||||
@@ -789,7 +789,7 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
|
||||
|
||||
/* merge with 2 adjacent regions */
|
||||
ret = lmb_reserve_flags(0x40060000, 0x10000, LMB_NOMAP);
|
||||
ut_asserteq(ret, 2);
|
||||
ut_asserteq(ret, 0);
|
||||
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 3, 0x40000000, 0x30000,
|
||||
0x40030000, 0x20000, 0x40050000, 0x30000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user