The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] misc: lan966x_pci: depopulate children on populate failure
@ 2026-06-16  0:43 Pengpeng Hou
  2026-06-16  6:28 ` Herve Codina
  2026-06-16  9:35 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-06-16  0:43 UTC (permalink / raw)
  To: Herve Codina, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel
  Cc: Pengpeng Hou

lan966x_pci_probe() loads the device-tree overlay and then populates
child devices from it. If of_platform_default_populate() fails after
creating any children, the error path removes the overlay without first
depopulating the partially-created children.

Mirror the remove path ordering on the populate failure path by
depopulating child devices before unloading the overlay.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/misc/lan966x_pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/lan966x_pci.c b/drivers/misc/lan966x_pci.c
index 0bb90c0943bf..823fa06aa1e7 100644
--- a/drivers/misc/lan966x_pci.c
+++ b/drivers/misc/lan966x_pci.c
@@ -178,10 +178,12 @@ static int lan966x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 
 	ret = of_platform_default_populate(dev_of_node(dev), NULL, dev);
 	if (ret)
-		goto err_unload_overlay;
+		goto err_depopulate;
 
 	return 0;
 
+err_depopulate:
+	of_platform_depopulate(dev);
 err_unload_overlay:
 	lan966x_pci_unload_overlay(data);
 	return ret;
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-16  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16  0:43 [PATCH] misc: lan966x_pci: depopulate children on populate failure Pengpeng Hou
2026-06-16  6:28 ` Herve Codina
2026-06-16  9:35 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox