misc: lan966x_pci: depopulate children on populate failure

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: 185686beb4 ("misc: Add support for LAN966x PCI device")
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260623015248.22721-1-pengpeng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Pengpeng Hou
2026-06-23 09:52:48 +08:00
committed by Greg Kroah-Hartman
parent e3a8557e88
commit f6e2ed54db

View File

@@ -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;
}