Browse Source

Bugfix: bitforce: Restore device name loading for FPGA Singles

Luke Dashjr 11 years ago
parent
commit
c12808e161
1 changed files with 9 additions and 4 deletions
  1. 9 4
      driver-bitforce.c

+ 9 - 4
driver-bitforce.c

@@ -204,6 +204,13 @@ static bool bitforce_detect_one(const char *devpath)
 	}
 	}
 	
 	
 	applog(LOG_DEBUG, "Found BitForce device on %s", devpath);
 	applog(LOG_DEBUG, "Found BitForce device on %s", devpath);
+	
+	if (likely((!memcmp(pdevbuf, ">>>ID: ", 7)) && (s = strstr(pdevbuf + 3, ">>>"))))
+	{
+		s[0] = '\0';
+		s = strdup(&pdevbuf[7]);
+	}
+	
 	initdata = malloc(sizeof(*initdata));
 	initdata = malloc(sizeof(*initdata));
 	*initdata = (struct bitforce_init_data){
 	*initdata = (struct bitforce_init_data){
 		.sc = false,
 		.sc = false,
@@ -303,10 +310,8 @@ static bool bitforce_detect_one(const char *devpath)
 	if (initdata->sc)
 	if (initdata->sc)
 		bitforce->cutofftemp = 85;
 		bitforce->cutofftemp = 85;
 
 
-	if (likely((!memcmp(pdevbuf, ">>>ID: ", 7)) && (s = strstr(pdevbuf + 3, ">>>")))) {
-		s[0] = '\0';
-		bitforce->name = strdup(pdevbuf + 7);
-	}
+	if (s)
+		bitforce->name = s;
 	bitforce->device_data = initdata;
 	bitforce->device_data = initdata;
 
 
 	mutex_init(&bitforce->device_mutex);
 	mutex_init(&bitforce->device_mutex);