[PATCH 2/2] memtest: Make use of resource_size()

Andrey Smirnov andrew.smirnov at gmail.com
Mon Sep 17 22:03:43 PDT 2018


Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 commands/memtest.c | 3 +--
 common/memtest.c   | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/commands/memtest.c b/commands/memtest.c
index 403ab91f6..dc8f7db27 100644
--- a/commands/memtest.c
+++ b/commands/memtest.c
@@ -36,8 +36,7 @@ static int do_test_one_area(struct mem_test_resource *r, int bus_only,
 	printf("Testing memory space: %pa -> %pa:\n",
 	       &r->r->start,  &r->r->end);
 
-	remap_range((void *)r->r->start, r->r->end -
-			r->r->start + 1, cache_flag);
+	remap_range((void *)r->r->start, resource_size(r->r), cache_flag);
 
 	ret = mem_test_bus_integrity(r->r->start, r->r->end);
 	if (ret < 0)
diff --git a/common/memtest.c b/common/memtest.c
index 5c96d46e9..44ddedd3d 100644
--- a/common/memtest.c
+++ b/common/memtest.c
@@ -131,8 +131,8 @@ void mem_test_release_regions(struct list_head *list)
 		/*
 		 * Ensure to leave with a cached on non used sdram regions.
 		 */
-		remap_range((void *)r->r->start, r->r->end -
-				r->r->start + 1, MAP_DEFAULT);
+		remap_range((void *)r->r->start, resource_size(r->r),
+			    MAP_DEFAULT);
 
 		release_sdram_region(r->r);
 		free(r);
-- 
2.17.1




More information about the barebox mailing list