Attention is currently required from: Nico Huber, Paul Menzel, Anastasia Klimchuk. Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59237 )
Change subject: tests: Set up mock chip memory in consistent and predictable way ......................................................................
Patch Set 6: Code-Review+1
(2 comments)
File tests/chip.c:
https://review.coreboot.org/c/flashrom/+/59237/comment/29291648_c2e54296 PS6, Line 33: .buf = { MOCK_CHIP_CONTENT }, This only initialises the first element of `buf`, the rest of the array is initialised to 0. I see it gets filled later on, but I find this potentially misleading.
I'd remove the static initialiser (or leave it to explicitly initialise to 0) and put the actual initialisation code in a helper function just below.
https://review.coreboot.org/c/flashrom/+/59237/comment/0541c335_3cc7c8fe PS6, Line 97: memset(&g_chip_state.buf[0], MOCK_CHIP_CONTENT, MOCK_CHIP_SIZE); How about:
memset(g_chip_state.buf, MOCK_CHIP_CONTENT, sizeof(g_chip_state.buf));