[Skiboot] [PATCH v2] occ-sensor: clean dt properties if sensor is not available

Balamuruhan S bala24 at linux.ibm.com
Wed Oct 16 20:14:39 AEDT 2019

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 at linux.ibm.com>
 hw/occ-sensor.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index d06ca725..8434c193 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -587,6 +587,10 @@ bool occ_sensors_init(void)
+	/* clear the device tree property if no sensors */
+	if (list_empty(&sg->children)) {
+               dt_free(sg);
+	}
 	if (!occ_num)
 		return false;

More information about the Skiboot mailing list