On Sat, 05 May 2012 01:22:12 +0200 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
Fix ICH SPI reprogram_opcode_on_the_fly return code.
i wouldnt call this a fix.
Helpful for SFDP debugging.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-sfdp_read_dummy_reduce_param_chunksize/ichspi.c
--- flashrom-ichspi_invalid_length_consistent/ichspi.c (Revision 1528) +++ flashrom-ichspi_invalid_length_consistent/ichspi.c (Arbeitskopie) @@ -416,7 +416,10 @@ msg_pdbg ("on-the-fly OPCODE (0x%02X) re-programmed, op-pos=%d\n", opcode, oppos); return oppos; }
- return -1;
- /* This case only happens if the writecnt/readcnt combination is
* impossible to achieve on ICH SPI.
*/
- return SPI_INVALID_LENGTH;
}
imho it would make more sense to have less comments + a cleaner code flow instead ;) see attached patch.
static int find_opcode(OPCODES *op, uint8_t opcode) @@ -1001,7 +1004,11 @@ if (opcode_index == -1) { if (!ichspi_lock) opcode_index = reprogram_opcode_on_the_fly(cmd, writecnt, readcnt);
if (opcode_index == -1) {
if (opcode_index == SPI_INVALID_LENGTH) {
msg_pdbg("OPCODE 0x%02x has unsupported length, will "
"not execute.\n", cmd);
return SPI_INVALID_LENGTH;
} else if (opcode_index == -1) { msg_pdbg("Invalid OPCODE 0x%02x, will not execute.\n", cmd); return SPI_INVALID_OPCODE;