From 0559d0bb6a084f960618df3ff8e699632e6fb4ef Mon Sep 17 00:00:00 2001 From: Denis Ahrens Date: Sun, 9 Dec 2012 23:56:36 +0100 Subject: [PATCH] libztex: in case the selectFpga() failed set the selected fpga to unknown after libztex_selectFpga() failed we can not be sure which fpga is now selected. can be the old one or maybe even the new one. so set the selected fpga variable to unknown so that the next call must set it again. --- libztex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libztex.c b/libztex.c index a34227e1..e640a755 100644 --- a/libztex.c +++ b/libztex.c @@ -535,6 +535,7 @@ int libztex_selectFpga(struct libztex_device *ztex) cnt = libusb_control_transfer(ztex->root->hndl, 0x40, 0x51, (uint16_t)number, 0, NULL, 0, 500); if (unlikely(cnt < 0)) { applog(LOG_ERR, "Ztex check device: Failed to set fpga with err %d", cnt); + ztex->root->selectedFpga = -1; return cnt; } ztex->root->selectedFpga = number;