public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mem_mtest: bail out after finding 1st memory error.
@ 2009-09-30 19:21 Paul Gortmaker
  2009-09-30 20:23 ` Wolfgang Denk
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Gortmaker @ 2009-09-30 19:21 UTC (permalink / raw)
  To: u-boot

The basic memtest function tries to watch for ^C after each
pattern pass as an escape mechanism, but if things are horribly
wrong, we'll be stuck in an inner loop flooding the console with
error messages and never check for ^C.  To make matters worse,
if the user waits for all the error messages to complete, we
then incorrectly report the test passed without errors.

By inspecting the code, it is clear that the test was originally
written with returning after the 1st error in mind (which is what
the optional more extensive test does).  Making it do this also
solves the endless console flood problem if a person tests really
bad RAM.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 common/cmd_mem.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 9850800..abcd8fd 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -631,7 +631,6 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	vu_long	*addr, *start, *end;
 	ulong	val;
 	ulong	readback;
-	int     rcode = 0;
 	int iterations = 1;
 	int iteration_limit;
 
@@ -923,7 +922,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 				printf ("\nMem error @ 0x%08X: "
 					"found %08lX, expected %08lX\n",
 					(uint)addr, readback, val);
-				rcode = 1;
+				return 1;
 			}
 			val += incr;
 		}
@@ -943,7 +942,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		incr = -incr;
 	}
 #endif
-	return rcode;
+	return 0;
 }
 
 
-- 
1.6.5.rc1

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

end of thread, other threads:[~2009-10-18 20:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30 19:21 [U-Boot] [PATCH] mem_mtest: bail out after finding 1st memory error Paul Gortmaker
2009-09-30 20:23 ` Wolfgang Denk
2009-09-30 20:53   ` Paul Gortmaker
2009-09-30 21:46     ` Wolfgang Denk
2009-10-01 14:00       ` Paul Gortmaker
2009-10-01 18:33         ` Wolfgang Denk
2009-10-01 23:52           ` [U-Boot] [PATCH] mem_mtest: fix error reporting, allow escape with ^C Paul Gortmaker
2009-10-01 23:57             ` Mike Frysinger
2009-10-02  0:04               ` Paul Gortmaker
2009-10-02 22:18                 ` Paul Gortmaker
2009-10-03  6:19                   ` Mike Frysinger
2009-10-18 20:57                   ` Wolfgang Denk

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