Hello Daniel Gröber,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/42118
to review the following change.
Change subject: spi/winbond: Merge redundant if wrapper into switch ......................................................................
spi/winbond: Merge redundant if wrapper into switch
Change-Id: I9c66fed2e4dcf4a13933c77e828ebc4ac4126ea4 Signed-off-by: Daniel Gröber dxld@darkboxed.org --- M src/drivers/spi/winbond.c 1 file changed, 22 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/42118/1
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c index d7a750b..49d3c5b 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -553,33 +553,33 @@ return -1; }
- if (mode != SPI_WRITE_PROTECTION_PRESERVE) { - switch (mode) { - case SPI_WRITE_PROTECTION_NONE: - bits->winbond.srp1 = 0; - bits->winbond.srp0 = 0; + switch (mode) { + case SPI_WRITE_PROTECTION_PRESERVE: break; - case SPI_WRITE_PROTECTION_PIN: - bits->winbond.srp1 = 0; - bits->winbond.srp0 = 1; + case SPI_WRITE_PROTECTION_NONE: + bits->winbond.srp1 = 0; + bits->winbond.srp0 = 0; break; - case SPI_WRITE_PROTECTION_REBOOT: + case SPI_WRITE_PROTECTION_PIN: + bits->winbond.srp1 = 0; + bits->winbond.srp0 = 1; + break; + case SPI_WRITE_PROTECTION_REBOOT: + bits->winbond.srp1 = 1; + bits->winbond.srp0 = 0; + break; + case SPI_WRITE_PROTECTION_PERMANENT: + if (params->bp_bits == 3) { bits->winbond.srp1 = 1; - bits->winbond.srp0 = 0; - break; - case SPI_WRITE_PROTECTION_PERMANENT: - if (params->bp_bits == 3) { - bits->winbond.srp1 = 1; - bits->winbond.srp0 = 1; - } else { - /* FIXME: special permanent protect write - * sequence not implemented. */ - return -1; - } - break; - default: + bits->winbond.srp0 = 1; + } else { + /* FIXME: special permanent protect write sequence + * not implemented. */ return -1; } + break; + default: + return -1; }
return 0;