Browse Source

Bugfix: bitforce: Close opened fd if reinit fails

Luke Dashjr 13 years ago
parent
commit
8534c62bb3
1 changed files with 2 additions and 0 deletions
  1. 2 0
      driver-bitforce.c

+ 2 - 0
driver-bitforce.c

@@ -211,6 +211,7 @@ void bitforce_init(struct cgpu_info *bitforce)
 
 
 		if (unlikely(!pdevbuf[0])) {
 		if (unlikely(!pdevbuf[0])) {
 			mutex_unlock(&bitforce->device_mutex);
 			mutex_unlock(&bitforce->device_mutex);
+			BFclose(fdDev);
 			applog(LOG_ERR, "BFL%i: Error reading/timeout (ZGX)", bitforce->device_id);
 			applog(LOG_ERR, "BFL%i: Error reading/timeout (ZGX)", bitforce->device_id);
 			return;
 			return;
 		}
 		}
@@ -221,6 +222,7 @@ void bitforce_init(struct cgpu_info *bitforce)
 
 
 	if (unlikely(!strstr(pdevbuf, "SHA256"))) {
 	if (unlikely(!strstr(pdevbuf, "SHA256"))) {
 		mutex_unlock(&bitforce->device_mutex);
 		mutex_unlock(&bitforce->device_mutex);
+		BFclose(fdDev);
 		applog(LOG_ERR, "BFL%i: Didn't recognise BitForce on %s returned: %s", bitforce->device_id, devpath, pdevbuf);
 		applog(LOG_ERR, "BFL%i: Didn't recognise BitForce on %s returned: %s", bitforce->device_id, devpath, pdevbuf);
 		return;
 		return;
 	}
 	}