All of lore.kernel.org
 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
  0 siblings, 1 reply; 2+ 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] 2+ messages in thread

* Re: [PATCH] misc: lan966x_pci: depopulate children on populate failure
  2026-06-16  0:43 [PATCH] misc: lan966x_pci: depopulate children on populate failure Pengpeng Hou
@ 2026-06-16  6:28 ` Herve Codina
  0 siblings, 0 replies; 2+ messages in thread
From: Herve Codina @ 2026-06-16  6:28 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel

Hi Pengpeng,

On Tue, 16 Jun 2026 08:43:04 +0800
Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:

> 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(-)

Indeed, thanks for the patch.

Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé

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

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

Thread overview: 2+ 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.