ft2232_spi: Improve error handling, remove exit() calls

In order to make the ft2232_spi code more usable in libflashrom (e.g. from
frontends/GUIs) there must not be any exit() calls in the code, as that
would also terminate the frontend. Thus, replace all exit() calls with
proper error handling code by returning a _unique_ negative error number,
so that the frontend (and/or user/developer) can also know a bit more
exactly _which_ error occured, not only _that_ an error occured.

Also, call ftdi_usb_close() before returning due to errors.

Corresponding to flashrom svn r1377.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Tadas Slotkus <devtadas@gmail.com>
1 file changed