mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
buspirate_spi: Use non-zero return value from buspirate_sendrecv
Return values for buspirate_sendrecv come from serialport_write and serialport_read, and those return 1s for any error. No need to explicity assign ret = 1, because it is already 1 for error. Follow up on commit 751afa88a7f22487069665c5d206ae490f158231 where this idea was suggested. BUG=b:185191942 TEST=builds Change-Id: I31fd70f607dc965d5cac1cd0116faa447dbc177a Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55818 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
16419f424e
commit
92b30ba800
@ -629,10 +629,8 @@ static int buspirate_spi_init(void)
|
||||
/* Enter raw SPI mode */
|
||||
bp_commbuf[0] = 0x01;
|
||||
ret = buspirate_sendrecv(bp_commbuf, 1, 0);
|
||||
if (ret) {
|
||||
ret = 1;
|
||||
if (ret)
|
||||
goto init_err_cleanup_exit;
|
||||
}
|
||||
if ((ret = buspirate_wait_for_string(bp_commbuf, "SPI")))
|
||||
goto init_err_cleanup_exit;
|
||||
if ((ret = buspirate_sendrecv(bp_commbuf, 0, 1)))
|
||||
@ -655,10 +653,8 @@ static int buspirate_spi_init(void)
|
||||
msg_pdbg("Enabling PSUs.\n");
|
||||
}
|
||||
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
|
||||
if (ret) {
|
||||
ret = 1;
|
||||
if (ret)
|
||||
goto init_err_cleanup_exit;
|
||||
}
|
||||
if (bp_commbuf[0] != 0x01) {
|
||||
msg_perr("Protocol error while setting power/CS/AUX(/Pull-up resistors)!\n");
|
||||
ret = 1;
|
||||
@ -668,10 +664,8 @@ static int buspirate_spi_init(void)
|
||||
/* Set SPI speed */
|
||||
bp_commbuf[0] = 0x60 | spispeed;
|
||||
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
|
||||
if (ret) {
|
||||
ret = 1;
|
||||
if (ret)
|
||||
goto init_err_cleanup_exit;
|
||||
}
|
||||
if (bp_commbuf[0] != 0x01) {
|
||||
msg_perr("Protocol error while setting SPI speed!\n");
|
||||
ret = 1;
|
||||
@ -685,10 +679,8 @@ static int buspirate_spi_init(void)
|
||||
msg_pdbg("Pull-ups enabled, so using HiZ pin output! (Open-Drain mode)\n");
|
||||
}
|
||||
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
|
||||
if (ret) {
|
||||
ret = 1;
|
||||
if (ret)
|
||||
goto init_err_cleanup_exit;
|
||||
}
|
||||
if (bp_commbuf[0] != 0x01) {
|
||||
msg_perr("Protocol error while setting SPI config!\n");
|
||||
ret = 1;
|
||||
@ -698,10 +690,8 @@ static int buspirate_spi_init(void)
|
||||
/* De-assert CS# */
|
||||
bp_commbuf[0] = 0x03;
|
||||
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
|
||||
if (ret) {
|
||||
ret = 1;
|
||||
if (ret)
|
||||
goto init_err_cleanup_exit;
|
||||
}
|
||||
if (bp_commbuf[0] != 0x01) {
|
||||
msg_perr("Protocol error while raising CS#!\n");
|
||||
ret = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user