summaryrefslogtreecommitdiff
path: root/cmd/mem.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2020-03-05 07:21:29 +0100
committerTom Rini <trini@konsulko.com>2020-04-17 12:32:36 -0400
commita8c708ea9f84cf637bb2bd5cfdcfd2dbbe71b86f (patch)
tree43dfb3032fae1ffd63fb1622792a329e279714bf /cmd/mem.c
parent71126d53df7aea9abb42b99b69c8d8b9cb5aa043 (diff)
cmd: mem: Correctly count the errors in mtest
This patch changes mtest to correctly count the overall errors and print them even in the abort (Ctrl-C) case. Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'cmd/mem.c')
-rw-r--r--cmd/mem.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/cmd/mem.c b/cmd/mem.c
index 6d54f19527..9367278aa8 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -871,7 +871,7 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
ulong start, end;
vu_long *buf, *dummy;
ulong iteration_limit = 0;
- int ret;
+ ulong count = 0;
ulong errs = 0; /* number of errors, or -1 if interrupted */
ulong pattern = 0;
int iteration;
@@ -929,6 +929,7 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
}
if (errs == -1UL)
break;
+ count += errs;
}
/*
@@ -947,14 +948,10 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
if (errs == -1UL) {
/* Memory test was aborted - write a newline to finish off */
putc('\n');
- ret = 1;
- } else {
- printf("Tested %d iteration(s) with %lu errors.\n",
- iteration, errs);
- ret = errs != 0;
}
+ printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
- return ret;
+ return errs != 0;
}
#endif /* CONFIG_CMD_MEMTEST */