aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBalamuruhan S <bala24@linux.ibm.com>2019-10-16 14:44:39 +0530
committerOliver O'Halloran <oohall@gmail.com>2019-10-22 17:31:54 +1100
commit61ec8655f4269227778a168bc5b14b4d3edd250b (patch)
tree940ebef7a3f080a4417fdce3d05aa79fc84cea7c /hw
parent233e863c8b1dccad8be7c39336d232a4a3994e6b (diff)
downloadskiboot-61ec8655f4269227778a168bc5b14b4d3edd250b.zip
skiboot-61ec8655f4269227778a168bc5b14b4d3edd250b.tar.gz
skiboot-61ec8655f4269227778a168bc5b14b4d3edd250b.tar.bz2
occ-sensor: clean dt properties if sensor is not available
In `occ_sensor_init()` device tree node is created for sensor-goups and performs `occ_sensor_sanity()` check to initialize the device tree. But if there are no sensors like in Qemu, sanity check fails but still device tree populates the sensor-groups node wrongly as the node created is not cleaned up. Signed-off-by: Balamuruhan S <bala24@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/occ-sensor.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index d06ca72..8434c19 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -587,6 +587,10 @@ bool occ_sensors_init(void)
free(phandles);
free(ptype);
}
+ /* clear the device tree property if no sensors */
+ if (list_empty(&sg->children)) {
+ dt_free(sg);
+ }
if (!occ_num)
return false;