Commit 92e1ffd374c64e3a957c35fb368fc35abd8e8847

Con Kolivas 2011-09-16T08:31:27

Store the targetfan even if the later getfanspeed fails in case it's temporary.

diff --git a/adl.c b/adl.c
index 1348534..b23a8fd 100644
--- a/adl.c
+++ b/adl.c
@@ -794,16 +794,16 @@ static int set_fanspeed(int gpu, int iFanSpeed)
 		return ret;
 	}
 
+	/* Store what fanspeed we're actually aiming for for re-entrant changes
+	 * in case this device does not support fine setting changes */
+	ga->targetfan = iFanSpeed;
+
 	lock_adl();
 	if (ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue) != ADL_OK) {
 		if (opt_debug)
 			applog(LOG_DEBUG, "GPU %d doesn't support fanspeed get", gpu);
 		goto out;
 	}
-
-	/* Store what fanspeed we're actually aiming for for re-entrant changes
-	 * in case this device does not support fine setting changes */
-	ga->targetfan = iFanSpeed;
 	if (!(ga->lpFanSpeedInfo.iFlags & ADL_DL_FANCTRL_SUPPORTS_PERCENT_WRITE)) {
 		/* Must convert speed to an RPM */
 		iFanSpeed = ga->lpFanSpeedInfo.iMaxRPM * iFanSpeed / 100;