mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] memtest: skip memory region smaller than one page
@ 2015-06-15  9:35 Renaud Barbier
  2015-06-16 13:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Renaud Barbier @ 2015-06-15  9:35 UTC (permalink / raw)
  To: barebox

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>
---
 commands/memtest.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/commands/memtest.c b/commands/memtest.c
index 9dec0ef..7561230 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;
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] memtest: skip memory region smaller than one page
  2015-06-15  9:35 [PATCH 1/2] memtest: skip memory region smaller than one page Renaud Barbier
@ 2015-06-16 13:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-06-16 13:59 UTC (permalink / raw)
  To: Renaud Barbier; +Cc: barebox

On Mon, Jun 15, 2015 at 10:35:41AM +0100, Renaud Barbier wrote:
> 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>
> ---
>  commands/memtest.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-16 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15  9:35 [PATCH 1/2] memtest: skip memory region smaller than one page Renaud Barbier
2015-06-16 13:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox