Browse Source

Demote failed hex2bin result to LOG_INFO and check return result in driver-bflsc to avoid doing find_work_by_midstate.

Con Kolivas 12 years ago
parent
commit
12a2cb0d3c
2 changed files with 7 additions and 3 deletions
  1. 6 2
      driver-bflsc.c
  2. 1 1
      util.c

+ 6 - 2
driver-bflsc.c

@@ -1322,8 +1322,12 @@ static void process_nonces(struct cgpu_info *bflsc, int dev, char *xlink, char *
 
 
 	memset(midstate, 0, MIDSTATE_BYTES);
 	memset(midstate, 0, MIDSTATE_BYTES);
 	memset(blockdata, 0, MERKLE_BYTES);
 	memset(blockdata, 0, MERKLE_BYTES);
-	hex2bin((unsigned char *)midstate, fields[QUE_MIDSTATE], MIDSTATE_BYTES);
-	hex2bin((unsigned char *)blockdata, fields[QUE_BLOCKDATA], MERKLE_BYTES);
+	if (!hex2bin((unsigned char *)midstate, fields[QUE_MIDSTATE], MIDSTATE_BYTES) ||
+	    !hex2bin((unsigned char *)blockdata, fields[QUE_BLOCKDATA], MERKLE_BYTES)) {
+		applog(LOG_ERR, "%s%i:%s Failed to convert binary data to hex result - ignored",
+		       bflsc->drv->name, bflsc->device_id, xlink);
+		inc_hw_errors(bflsc->thr[0]);
+	}
 
 
 	work = find_queued_work_bymidstate(bflsc, midstate, MIDSTATE_BYTES,
 	work = find_queued_work_bymidstate(bflsc, midstate, MIDSTATE_BYTES,
 						blockdata, MERKLE_OFFSET, MERKLE_BYTES);
 						blockdata, MERKLE_OFFSET, MERKLE_BYTES);

+ 1 - 1
util.c

@@ -615,7 +615,7 @@ bool hex2bin(unsigned char *p, const char *hexstr, size_t len)
 		hex_byte[1] = hexstr[1];
 		hex_byte[1] = hexstr[1];
 
 
 		if (unlikely(sscanf(hex_byte, "%x", &v) != 1)) {
 		if (unlikely(sscanf(hex_byte, "%x", &v) != 1)) {
-			applog(LOG_ERR, "hex2bin sscanf '%s' failed", hex_byte);
+			applog(LOG_INFO, "hex2bin sscanf '%s' failed", hex_byte);
 			return ret;
 			return ret;
 		}
 		}