Skip to content

Commit

Permalink
occ-sensor: clean dt properties if sensor is not available
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
balamuruhans authored and oohal committed Oct 22, 2019
1 parent 233e863 commit 61ec865
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hw/occ-sensor.c
Expand Up @@ -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;
Expand Down

0 comments on commit 61ec865

Please sign in to comment.