summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2019-07-03 22:12:30 +0000
committerkettenis <kettenis@openbsd.org>2019-07-03 22:12:30 +0000
commitfc1dafb7217dc02ef66304fcee1267d9904ddae4 (patch)
treea833410751d43115ae2b72a52fd28424ac219944
parentOF_finddevice(9) returns -1 if the node in question couldn't be found. (diff)
downloadwireguard-openbsd-fc1dafb7217dc02ef66304fcee1267d9904ddae4.tar.xz
wireguard-openbsd-fc1dafb7217dc02ef66304fcee1267d9904ddae4.zip
Skip thermal zones without "trips" or "cooling-maps" nodes.
-rw-r--r--sys/dev/ofw/ofw_thermal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/ofw/ofw_thermal.c b/sys/dev/ofw/ofw_thermal.c
index 562866f7f36..9a1bc6866a9 100644
--- a/sys/dev/ofw/ofw_thermal.c
+++ b/sys/dev/ofw/ofw_thermal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_thermal.c,v 1.2 2019/07/03 21:20:14 kettenis Exp $ */
+/* $OpenBSD: ofw_thermal.c,v 1.3 2019/07/03 22:12:30 kettenis Exp $ */
/*
* Copyright (c) 2019 Mark Kettenis
*
@@ -327,6 +327,11 @@ thermal_zone_init(int node)
if (len <= 0)
return;
+ if (OF_getnodebyname(node, "trips") == 0)
+ return;
+ if (OF_getnodebyname(node, "cooling-maps") == 0)
+ return;
+
tz = malloc(sizeof(struct thermal_zone), M_DEVBUF, M_ZERO | M_WAITOK);
tz->tz_node = node;