Skip to content

Commit 560ee3b

Browse files
committed
u-boot: v2026.04: helios64: preserve SPI I/O error in read_otp_data
spi_write_then_read() returned value was only used to set has_been_read, then header/CRC checks ran against whatever ended up in the otp struct. On a real SPI I/O failure, the struct could contain partial garbage, header/CRC would fail, and the caller got a generic -1 — losing the original errno and conflating I/O errors with invalid OTP data. Handle the I/O error path explicitly: - On ret != 0: log, keep has_been_read = 0 (so the next call can retry), and return the original ret. - On ret == 0: set has_been_read = 1 and proceed to header/CRC validation as before. Addresses a CodeRabbit review comment on PR armbian#9675.
1 parent 611fff6 commit 560ee3b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • patch/u-boot/v2026.04/board_helios64/board

patch/u-boot/v2026.04/board_helios64/board/sys_otp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,13 @@ int read_otp_data(void)
177177
show_otp_data();
178178
#endif
179179

180-
has_been_read = (ret == 0) ? 1 : 0;
180+
if (ret) {
181+
debug("SPI: Failed to read OTP: %d\n", ret);
182+
/* Leave has_been_read = 0 so a later call can retry. */
183+
return ret;
184+
}
185+
has_been_read = 1;
186+
181187
if (!is_valid_header())
182188
goto data_invalid;
183189

0 commit comments

Comments
 (0)