[PATCH] firmware: ti_sci: undo list publication on populate failure

Pengpeng Hou pengpeng at iscas.ac.cn
Mon Jun 15 17:47:41 PDT 2026


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 at iscas.ac.cn>
---
 drivers/firmware/ti_sci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index e027a2bd8f26..670ed1fcd8ef 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -4050,6 +4050,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;
-- 
2.50.1 (Apple Git-155)




More information about the linux-arm-kernel mailing list