From 61ec8655f4269227778a168bc5b14b4d3edd250b Mon Sep 17 00:00:00 2001 From: Balamuruhan S Date: Wed, 16 Oct 2019 14:44:39 +0530 Subject: 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 Signed-off-by: Oliver O'Halloran --- hw/occ-sensor.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'hw') 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; -- cgit v1.1