aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2015-10-01 18:37:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-01 21:42:35 -0400
commit44241628bb207ec211bebd156aaf69470d90c209 (patch)
tree2b0c143661cf3d9fbc66f5241854df85f0164a78
parentef510194cefe0cd369ef73419cd65b0a5bb4fb5b (diff)
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>
-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 7ff96270c933..e570ff084add 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,
144 switch_on_temp = 0; 144 switch_on_temp = 0;
145 145
146 temperature_threshold = control_temp - switch_on_temp; 146 temperature_threshold = control_temp - switch_on_temp;
147 /*
148 * estimate_pid_constants() tries to find appropriate default
149 * values for thermal zones that don't provide them. If a
150 * system integrator has configured a thermal zone with two
151 * passive trip points at the same temperature, that person
152 * hasn't put any effort to set up the thermal zone properly
153 * so just give up.
154 */
155 if (!temperature_threshold)
156 return;
147 157
148 if (!tz->tzp->k_po || force) 158 if (!tz->tzp->k_po || force)
149 tz->tzp->k_po = int_to_frac(sustainable_power) / 159 tz->tzp->k_po = int_to_frac(sustainable_power) /