Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234504

[PATCH] thermal: avoid division by zero in power allocator

From Andrea Arcangeli <aarcange@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] thermal: avoid division by zero in power allocator
Date 2015-09-28 23:30 +0200
Message-ID <qdO9J-34R-11@gated-at.bofh.it> (permalink)
References <qdO9J-34R-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


During boot I get a div by zero Oops regression starting in v4.3-rc3.

Reviewed-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
 drivers/thermal/power_allocator.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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) /
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] thermal: avoid division by zero in power allocator Andrea Arcangeli <aarcange@redhat.com> - 2015-09-28 23:30 +0200
  Re: [PATCH] thermal: avoid division by zero in power allocator Andrew Morton <akpm@linux-foundation.org> - 2015-09-29 22:40 +0200
    Re: [PATCH] thermal: avoid division by zero in power allocator Javi Merino <javi.merino@arm.com> - 2015-10-01 12:20 +0200

csiph-web