1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

Remove exit calls from sp_sync_read_timeout and sp_synchronize

Add return values to sp_synchronize so we can signal a failure to the
only upstream caller (serprog_init), which is prepared to propagate a failure.

sp_sync_read_timeout was harder to fix because it already used a return
value, but we needed to distinguish two different failure modes. This
solution distinguishes them by the sign of the return values, which maintains
readability as much as possible.

Thanks to Niklas Söderlund for the original patch and idea.

Corresponding to flashrom svn r1595.

Signed-off-by: Niklas Söderlund <niso@kth.se>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Niklas Söderlund
2012-09-07 07:07:07 +00:00
committed by Stefan Tauner
parent d932fd0d8c
commit 7145a50f53
2 changed files with 49 additions and 28 deletions

View File

@ -239,6 +239,7 @@ void sp_flush_incoming(void)
#ifdef _WIN32
PurgeComm(sp_fd, PURGE_RXCLEAR);
#else
/* FIXME: error handling */
tcflush(sp_fd, TCIFLUSH);
#endif
return;