firmware: ti_sci: Undo list publication on populate failure

ti_sci_probe() publishes the controller on the global ti_sci_list
before creating child devices. If of_platform_populate() fails
after creating some children, the probe error path leaves the
children around and leaves the failed controller visible through
ti_sci_get_handle().

Depopulate any children created by the failed populate call and remove
the controller from the global list before returning the probe error.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260616004741.1726-1-pengpeng@iscas.ac.cn
Signed-off-by: Nishanth Menon <nm@ti.com>
This commit is contained in:
Pengpeng Hou 2026-06-16 08:47:41 +08:00 committed by Nishanth Menon
parent dc59e4fea9
commit f52ddaf5e7

View File

@ -4225,6 +4225,10 @@ static int ti_sci_probe(struct platform_device *pdev)
ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
if (ret) {
dev_err(dev, "platform_populate failed %pe\n", ERR_PTR(ret));
of_platform_depopulate(dev);
mutex_lock(&ti_sci_list_mutex);
list_del(&info->node);
mutex_unlock(&ti_sci_list_mutex);
goto out;
}
return 0;