diff options
author | Renaud Barbier <renaud.barbier@ge.com> | 2015-06-15 10:35:41 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-16 15:59:04 +0200 |
commit | c83950aa03aba32b250c2084705ba91d076a0c9d (patch) | |
tree | a0829ea0dd48eaaa0ac7e09bb1447dd51895fbbf /commands/memtest.c | |
parent | dae7498d2c49f812d513123908074f577e86efee (diff) | |
download | barebox-c83950aa03aba32b250c2084705ba91d076a0c9d.tar.gz |
memtest: skip memory region smaller than one page
If the size between memory regions is smaller than one page, the
size is rounded down to 0. This results in a region request failure.
This commit skips the memory region whose size is smaller than a page.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/memtest.c')
-rw-r--r-- | commands/memtest.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/commands/memtest.c b/commands/memtest.c index 9dec0efcba..756123001a 100644 --- a/commands/memtest.c +++ b/commands/memtest.c @@ -62,9 +62,11 @@ static int request_memtest_regions(struct list_head *list) start = PAGE_ALIGN(bank->res->start); size = PAGE_ALIGN_DOWN(bank->res->end - start + 1); - ret = alloc_memtest_region(list, start, size); - if (ret < 0) - return ret; + if (size) { + ret = alloc_memtest_region(list, start, size); + if (ret < 0) + return ret; + } continue; } @@ -95,6 +97,8 @@ static int request_memtest_regions(struct list_head *list) continue; size = PAGE_ALIGN_DOWN(end - start + 1); + if (size == 0) + continue; ret = alloc_memtest_region(list, start, size); if (ret < 0) return ret; @@ -108,7 +112,7 @@ static int request_memtest_regions(struct list_head *list) start = PAGE_ALIGN(r->end); end = bank->res->end; size = PAGE_ALIGN_DOWN(end - start + 1); - if (start < end && start > r->end) { + if (size && start < end && start > r->end) { ret = alloc_memtest_region(list, start, size); if (ret < 0) return ret; |