spi25: Fix cosmetic debug-print error due to unitialized buffer
spi_prepare_address() expects `cmd_buf[0]` to be filled already,
for proper debug prints.
Change-Id: I03b45be7e00d00d37b32553df0991a1b608aae35
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/322
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/spi25.c b/spi25.c
index c43ffc6..b1d6288 100644
--- a/spi25.c
+++ b/spi25.c
@@ -694,13 +694,12 @@
{
const struct spi_read_op *const read_op = get_spi_read_op(flash);
const size_t mode_len = read_op->mode_byte ? 1 : 0;
- uint8_t cmd_buf[1 + JEDEC_MAX_ADDR_LEN + 1];
+ uint8_t cmd_buf[1 + JEDEC_MAX_ADDR_LEN + 1] = { read_op->opcode, };
const int addr_len = spi_prepare_address(flash, cmd_buf, read_op->native_4ba, address);
if (addr_len < 0)
return 1;
- cmd_buf[0] = read_op->opcode;
cmd_buf[addr_len + 1] = read_op->mode_byte;
struct spi_command cmd[] = {