diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-06-27 15:22:33 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-01 19:45:11 +0000 |
commit | c546e1b07ec88cd9749b42720ae0593b86292a1c (patch) | |
tree | 73887e3c9a1fb9edfc67f9cff633953d50a8cf8e /test/shmalloc.c | |
parent | 9f5a844244b1152c4b0535bd8507be1ebc7e3018 (diff) | |
download | chrome-ec-c546e1b07ec88cd9749b42720ae0593b86292a1c.tar.gz |
test/shmalloc.c: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: Ifb5eda7d533a472645e65c54a5425c16e4531eee
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730522
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'test/shmalloc.c')
-rw-r--r-- | test/shmalloc.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/test/shmalloc.c b/test/shmalloc.c index a596d173e7..b77f720ac9 100644 --- a/test/shmalloc.c +++ b/test/shmalloc.c @@ -36,14 +36,14 @@ static uint32_t next = 127; static uint32_t myrand(void) { next = next * 1103515245 + 12345; - return ((uint32_t)(next/65536) % 32768); + return ((uint32_t)(next / 65536) % 32768); } /* Keep track of buffers allocated by the test function. */ static struct { void *buf; size_t buffer_size; -} allocations[12]; /* Up to 12 buffers could be allocated concurrently. */ +} allocations[12]; /* Up to 12 buffers could be allocated concurrently. */ /* * Verify that allocated and free buffers do not overlap, and that our and @@ -77,8 +77,7 @@ static int check_for_overlaps(void) * multiple times to keep things simple. */ allocated_count = 0; - for (allocced_buf = allocced_buf_chain; - allocced_buf; + for (allocced_buf = allocced_buf_chain; allocced_buf; allocced_buf = allocced_buf->next_buffer) { int allocated_size, allocation_size; @@ -117,8 +116,8 @@ static int check_for_overlaps(void) } } if (allocations_count != allocated_count) { - ccprintf("count mismatch (%d != %d)!\n", - allocations_count, allocated_count); + ccprintf("count mismatch (%d != %d)!\n", allocations_count, + allocated_count); return 0; } return 1; @@ -146,10 +145,10 @@ static int shmem_is_ok(int line) running_size += pbuf->buffer_size; if (count++ > 100) - goto bailout; /* Is there a loop? */ + goto bailout; /* Is there a loop? */ top = (struct shm_buffer *)((uintptr_t)pbuf + - pbuf->buffer_size); + pbuf->buffer_size); if (pbuf->next_buffer) { if (top >= pbuf->next_buffer) { ccprintf("%s:%d" @@ -193,7 +192,7 @@ static int shmem_is_ok(int line) return 1; - bailout: +bailout: ccprintf("Line %d, counter %d. The list has been corrupted, " "total size %d, running size %d\n", line, counter, total_size, running_size); @@ -229,8 +228,7 @@ void run_test(int argc, char **argv) if (test_map & ~ALL_PATHS_MASK) { ccprintf("Unexpected mask bits set: %x" ", counter %d\n", - test_map & ~ALL_PATHS_MASK, - counter); + test_map & ~ALL_PATHS_MASK, counter); test_fail(); return; } @@ -261,7 +259,7 @@ void run_test(int argc, char **argv) */ if (shared_mem_acquire(alloc_size, &shptr) == EC_SUCCESS) { - allocations[index].buf = (void *) shptr; + allocations[index].buf = (void *)shptr; allocations[index].buffer_size = alloc_size; /* @@ -269,8 +267,8 @@ void run_test(int argc, char **argv) * modified. */ while (alloc_size--) - shptr[alloc_size] = - shptr[alloc_size] ^ 0xff; + shptr[alloc_size] = shptr[alloc_size] ^ + 0xff; if (!shmem_is_ok(__LINE__)) { test_fail(); @@ -294,8 +292,8 @@ void run_test(int argc, char **argv) } } - ccprintf("Did not pass all paths, map %x != %x\n", - test_map, ALL_PATHS_MASK); + ccprintf("Did not pass all paths, map %x != %x\n", test_map, + ALL_PATHS_MASK); test_fail(); } |