summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-12-04 08:01:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-12-04 08:01:59 +0100
commitc85ef6a7766427c99487c5c22b50ea34ca78f72f (patch)
tree9a8a9b377c621733c26909158fd3d9c9b795bcd4 /common
parent770c1ef83c2628cea4e9070810609b102037339a (diff)
downloadbarebox-c85ef6a7766427c99487c5c22b50ea34ca78f72f.tar.gz
Revert "memtest: move error handling to end of function"
While this simplifies the code as is I got the request to continue on errors in memtest, which can be better implemented when the messages are printed inline and not at the end of the function. This reverts commit 4ff9e28abc2e31dabde6d71503219b3e50d9f4e3.
Diffstat (limited to 'common')
-rw-r--r--common/memtest.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/common/memtest.c b/common/memtest.c
index 401b902..8af998e 100644
--- a/common/memtest.c
+++ b/common/memtest.c
@@ -363,7 +363,7 @@ static int update_progress(resource_size_t offset)
int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
{
- volatile resource_size_t *start, num_words, offset, pattern, expected;
+ volatile resource_size_t *start, num_words, offset, temp, anti_pattern;
int ret;
_start = ALIGN(_start, sizeof(resource_size_t));
@@ -405,13 +405,17 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
if (ret)
return ret;
- pattern = start[offset];
- expected = offset + 1;
-
- if (pattern != expected)
- goto mem_err;
+ temp = start[offset];
+ if (temp != (offset + 1)) {
+ printf("\n");
+ mem_test_report_failure("read/write",
+ (offset + 1),
+ temp, &start[offset]);
+ return -EIO;
+ }
- start[offset] = ~start[offset];
+ anti_pattern = ~(offset + 1);
+ start[offset] = anti_pattern;
}
/* Check each location for the inverted pattern and zero it */
@@ -420,11 +424,16 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
if (ret)
return ret;
- pattern = start[offset];
- expected = ~(offset + 1);
+ anti_pattern = ~(offset + 1);
+ temp = start[offset];
- if (pattern != expected)
- goto mem_err;
+ if (temp != anti_pattern) {
+ printf("\n");
+ mem_test_report_failure("read/write",
+ anti_pattern,
+ temp, &start[offset]);
+ return -EIO;
+ }
start[offset] = 0;
}
@@ -434,10 +443,4 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
printf("\n");
return 0;
-
-mem_err:
- printf("\n");
- mem_test_report_failure("read/write", expected, pattern, &start[offset]);
-
- return -EIO;
}