-/* $OpenBSD: thermal.c,v 1.4 2016/05/23 11:28:57 mglocker Exp $ */
+/* $OpenBSD: thermal.c,v 1.5 2016/07/29 04:41:53 jsg Exp $ */
/*-
* Copyright (c) 2009-2011 Nathan Whitehorn
average_excess += frac_excess;
nsens++;
}
- average_excess /= nsens;
- /* If there are no sensors in this zone, use the average */
- if (nsens_zone == 0)
- max_excess_zone = average_excess;
/* No sensors at all? Use default */
if (nsens == 0) {
fan->fan->set(fan->fan, fan->fan->default_rpm);
continue;
}
+ average_excess /= nsens;
+
+ /* If there are no sensors in this zone, use the average */
+ if (nsens_zone == 0)
+ max_excess_zone = average_excess;
+
/*
* Scale the fan linearly in the max temperature in its
* thermal zone.