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

Oliver O'Halloran oohall at gmail.com
Wed Oct 30 17:25:54 AEDT 2019


On Wed, Oct 16, 2019 at 8:14 PM Balamuruhan S <bala24 at linux.ibm.com> wrote:
>
> 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.

merged as of 61ec8655f426

>
> 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)
>                 free(phandles);
>                 free(ptype);
>         }
> +       /* clear the device tree property if no sensors */
> +       if (list_empty(&sg->children)) {
> +               dt_free(sg);
> +       }

Just for future reference single line if statements shouldn't have
braces wrapping them. I was meaning on just fixing it up when I merged
the patch, but I forgot. Patches welcome!

Oliver


More information about the Skiboot mailing list