summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/power_allocator.c
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2015-10-01 15:37:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-01 21:42:35 -0400
commit44241628bb207ec211bebd156aaf69470d90c209 (patch)
tree2b0c143661cf3d9fbc66f5241854df85f0164a78 /drivers/thermal/power_allocator.c
parentef510194cefe0cd369ef73419cd65b0a5bb4fb5b (diff)
downloadop-kernel-dev-44241628bb207ec211bebd156aaf69470d90c209.zip
op-kernel-dev-44241628bb207ec211bebd156aaf69470d90c209.tar.gz
thermal: avoid division by zero in power allocator
During boot I get a div by zero Oops regression starting in v4.3-rc3. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Javi Merino <javi.merino@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/thermal/power_allocator.c')
-rw-r--r--drivers/thermal/power_allocator.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c
index 7ff9627..e570ff0 100644
--- a/drivers/thermal/power_allocator.c
+++ b/drivers/thermal/power_allocator.c
@@ -144,6 +144,16 @@ static void estimate_pid_constants(struct thermal_zone_device *tz,
switch_on_temp = 0;
temperature_threshold = control_temp - switch_on_temp;
+ /*
+ * estimate_pid_constants() tries to find appropriate default
+ * values for thermal zones that don't provide them. If a
+ * system integrator has configured a thermal zone with two
+ * passive trip points at the same temperature, that person
+ * hasn't put any effort to set up the thermal zone properly
+ * so just give up.
+ */
+ if (!temperature_threshold)
+ return;
if (!tz->tzp->k_po || force)
tz->tzp->k_po = int_to_frac(sustainable_power) /
OpenPOWER on IntegriCloud