All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] misc: lan966x_pci: depopulate children on populate failure
@ 2026-06-22 15:33 Pengpeng Hou
  2026-06-22 18:45 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-22 15:33 UTC (permalink / raw)
  To: Herve Codina, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-kernel, pengpeng, kernel test robot

lan966x_pci_probe() may create child platform devices before
of_platform_default_populate() returns an error.  The error path unloads
the overlay immediately, but it does not depopulate any children that
were already created from overlay nodes.

Depopulate the children before unloading the overlay when population
fails.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606161724.uAEP4nTA-lkp@intel.com/
---
Changes since v1:
- Avoid adding an unused error label by depopulating inline before jumping
  to the existing overlay unload label.

 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 9e63076d3de0..0a2945f5f4d4 100644
--- a/drivers/misc/lan966x_pci.c
+++ b/drivers/misc/lan966x_pci.c
@@ -178,8 +178,10 @@ static int lan966x_pci_probe(struct pci_dev *pdev,
 	pci_set_master(pdev);
 
 	ret = of_platform_default_populate(dev_of_node(dev), NULL, dev);
-	if (ret)
+	if (ret) {
+		of_platform_depopulate(dev);
 		goto err_unload_overlay;
+	}
 
 	return 0;
 
-- 
2.50.1


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

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

On Mon, Jun 22, 2026 at 11:33:28PM +0800, Pengpeng Hou wrote:
> lan966x_pci_probe() may create child platform devices before
> of_platform_default_populate() returns an error.  The error path unloads
> the overlay immediately, but it does not depopulate any children that
> were already created from overlay nodes.
> 
> Depopulate the children before unloading the overlay when population
> fails.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> Reviewed-by: Herve Codina <herve.codina@bootlin.com>
> Reported-by: kernel test robot <lkp@intel.com>

The test robot did not report this problem :(

thanks,

greg k-h

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

end of thread, other threads:[~2026-06-22 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 15:33 [PATCH v2] misc: lan966x_pci: depopulate children on populate failure Pengpeng Hou
2026-06-22 18:45 ` Greg Kroah-Hartman

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.