From 42529beba5a262992b53893477e0de646c1754b6 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 22 Aug 2025 20:18:48 +0200 Subject: [PATCH] memtest: remove use of vu_long typedef in mem_test_alt Hiding a qualifier such as "volatile" inside a typedef makes the code much harder to understand. Since addr and dummy being volatile-qualified are important for the correctness of the test code, make it more obvious by spelling it out as "volatile ulong". Signed-off-by: Rasmus Villemoes Tested-by: Anshul Dalal --- cmd/mem.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/mem.c b/cmd/mem.c index b67368dfba5..d5d7ca2790b 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -712,10 +712,10 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, #endif /* CONFIG_LOOPW */ #ifdef CONFIG_CMD_MEMTEST -static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, - vu_long *dummy) +static ulong mem_test_alt(volatile ulong *buf, ulong start_addr, ulong end_addr, + volatile ulong *dummy) { - vu_long *addr; + volatile ulong *addr; ulong errs = 0; ulong val, readback; int j; @@ -735,7 +735,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, /* Rate-limit schedule() calls to one for every 256 words. */ u8 count = 0; - num_words = (end_addr - start_addr) / sizeof(vu_long); + num_words = (end_addr - start_addr) / sizeof(ulong); /* * Data line test: write a pattern to the first @@ -817,8 +817,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * * Returns: 0 if the test succeeds, 1 if the test fails. */ - pattern = (vu_long)0xaaaaaaaaaaaaaaaa; - anti_pattern = (vu_long)0x5555555555555555; + pattern = (ulong)0xaaaaaaaaaaaaaaaa; + anti_pattern = (ulong)0x5555555555555555; debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words); /* @@ -839,7 +839,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, if (temp != pattern) { printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), pattern, temp); errs++; if (ctrlc()) @@ -861,7 +861,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, printf("\nFAILURE: Address bit stuck low or" " shorted @ 0x%.8lx: expected 0x%.8lx," " actual 0x%.8lx\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), pattern, temp); errs++; if (ctrlc()) @@ -904,7 +904,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, if (temp != pattern) { printf("\nFAILURE (read/write) @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx)\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), pattern, temp); errs++; if (ctrlc()) @@ -926,7 +926,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, if (temp != anti_pattern) { printf("\nFAILURE (read/write): @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx)\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), anti_pattern, temp); errs++; if (ctrlc()) -- 2.47.3