Edward O'Callaghan has uploaded this change for review.

View Change

spi25.c: Improve spi_simple_write_cmd() diags and readability

Clearly initialise the cmds[] array of structures with explicit
values and improve failure diagnostic line to inline failing op.

BUG=b:170690915
BRANCH=none
TEST=shows opcode

Change-Id: Ib9fc82558035e511ee485fb5aab0bcd3e164c6ba
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M spi25.c
1 file changed, 5 insertions(+), 3 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/52/47452/1
diff --git a/spi25.c b/spi25.c
index 213273f..41fa3dd 100644
--- a/spi25.c
+++ b/spi25.c
@@ -324,20 +324,22 @@
{
struct spi_command cmds[] = {
{
- .readarr = 0,
.writecnt = JEDEC_WREN_OUTSIZE,
.writearr = (const unsigned char[]){ JEDEC_WREN },
+ .readcnt = 0,
+ .readarr = NULL,
}, {
- .readarr = 0,
.writecnt = 1,
.writearr = (const unsigned char[]){ op },
+ .readcnt = 0,
+ .readarr = NULL,
},
NULL_SPI_CMD,
};

const int result = spi_send_multicommand(flash, cmds);
if (result)
- msg_cerr("%s failed during command execution\n", __func__);
+ msg_cerr("%s: opcode=0x%x failed during command execution\n", __func__, op);

const int status = poll_delay ? spi_poll_wip(flash, poll_delay) : 0;


To view, visit change 47452. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib9fc82558035e511ee485fb5aab0bcd3e164c6ba
Gerrit-Change-Number: 47452
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange