[PATCH v3] misc: lan966x_pci: depopulate children on populate failure
From: Pengpeng Hou
Date: Mon Jun 22 2026 - 21:58:35 EST
lan966x_pci_probe() applies a device-tree overlay and then populates
platform children from the overlaid node. If
of_platform_default_populate() creates some children and then fails, the
current error path only unloads the overlay.
Depopulate the children before unloading the overlay on that failure
path, matching the remove path order.
Fixes: 185686beb464 ("misc: Add support for LAN966x PCI device")
Reviewed-by: Herve Codina <herve.codina@xxxxxxxxxxx>
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
Changes since v2: https://lore.kernel.org/all/20260622153328.81634-1-pengpeng@xxxxxxxxxxx/
- remove the incorrect LKP Reported-by and Closes tags; the code is
unchanged from v2
drivers/misc/lan966x_pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/misc/lan966x_pci.c b/drivers/misc/lan966x_pci.c
index 0bb90c0943bf..b0949c653e5b 100644
--- a/drivers/misc/lan966x_pci.c
+++ b/drivers/misc/lan966x_pci.c
@@ -183,6 +183,7 @@ static int lan966x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
return 0;
err_unload_overlay:
+ of_platform_depopulate(dev);
lan966x_pci_unload_overlay(data);
return ret;
}
--
2.50.1 (Apple Git-155)