* [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
* 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
2026-06-16 9:35 ` kernel test robot
1 sibling, 0 replies; 3+ 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] 3+ 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
@ 2026-06-16 9:35 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-06-16 9:35 UTC (permalink / raw)
To: Pengpeng Hou, Herve Codina, Arnd Bergmann, Greg Kroah-Hartman,
linux-kernel
Cc: oe-kbuild-all, Pengpeng Hou
Hi Pengpeng,
kernel test robot noticed the following build warnings:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus soc/for-next linus/master v7.1 next-20260615]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pengpeng-Hou/misc-lan966x_pci-depopulate-children-on-populate-failure/20260616-091550
base: char-misc/char-misc-testing
patch link: https://lore.kernel.org/r/20260616004304.95117-1-pengpeng%40iscas.ac.cn
patch subject: [PATCH] misc: lan966x_pci: depopulate children on populate failure
config: loongarch-randconfig-001-20260616 (https://download.01.org/0day-ci/archive/20260616/202606161724.uAEP4nTA-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260616/202606161724.uAEP4nTA-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606161724.uAEP4nTA-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/misc/lan966x_pci.c: In function 'lan966x_pci_probe':
>> drivers/misc/lan966x_pci.c:187:1: warning: label 'err_unload_overlay' defined but not used [-Wunused-label]
187 | err_unload_overlay:
| ^~~~~~~~~~~~~~~~~~
vim +/err_unload_overlay +187 drivers/misc/lan966x_pci.c
185686beb464996 Herve Codina 2024-10-14 138
185686beb464996 Herve Codina 2024-10-14 139 static int lan966x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
185686beb464996 Herve Codina 2024-10-14 140 {
185686beb464996 Herve Codina 2024-10-14 141 struct device *dev = &pdev->dev;
185686beb464996 Herve Codina 2024-10-14 142 struct lan966x_pci *data;
185686beb464996 Herve Codina 2024-10-14 143 int ret;
185686beb464996 Herve Codina 2024-10-14 144
185686beb464996 Herve Codina 2024-10-14 145 /*
185686beb464996 Herve Codina 2024-10-14 146 * On ACPI system, fwnode can point to the ACPI node.
185686beb464996 Herve Codina 2024-10-14 147 * This driver needs an of_node to be used as the device-tree overlay
185686beb464996 Herve Codina 2024-10-14 148 * target. This of_node should be set by the PCI core if it succeeds in
185686beb464996 Herve Codina 2024-10-14 149 * creating it (CONFIG_PCI_DYNAMIC_OF_NODES feature).
185686beb464996 Herve Codina 2024-10-14 150 * Check here for the validity of this of_node.
185686beb464996 Herve Codina 2024-10-14 151 */
185686beb464996 Herve Codina 2024-10-14 152 if (!dev_of_node(dev))
185686beb464996 Herve Codina 2024-10-14 153 return dev_err_probe(dev, -EINVAL, "Missing of_node for device\n");
185686beb464996 Herve Codina 2024-10-14 154
185686beb464996 Herve Codina 2024-10-14 155 /* Need to be done before devm_pci_dev_create_intr_ctrl.
185686beb464996 Herve Codina 2024-10-14 156 * It allocates an IRQ and so pdev->irq is updated.
185686beb464996 Herve Codina 2024-10-14 157 */
185686beb464996 Herve Codina 2024-10-14 158 ret = pcim_enable_device(pdev);
185686beb464996 Herve Codina 2024-10-14 159 if (ret)
185686beb464996 Herve Codina 2024-10-14 160 return ret;
185686beb464996 Herve Codina 2024-10-14 161
185686beb464996 Herve Codina 2024-10-14 162 ret = devm_pci_dev_create_intr_ctrl(pdev);
185686beb464996 Herve Codina 2024-10-14 163 if (ret)
185686beb464996 Herve Codina 2024-10-14 164 return ret;
185686beb464996 Herve Codina 2024-10-14 165
185686beb464996 Herve Codina 2024-10-14 166 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
185686beb464996 Herve Codina 2024-10-14 167 if (!data)
185686beb464996 Herve Codina 2024-10-14 168 return -ENOMEM;
185686beb464996 Herve Codina 2024-10-14 169
185686beb464996 Herve Codina 2024-10-14 170 pci_set_drvdata(pdev, data);
185686beb464996 Herve Codina 2024-10-14 171 data->dev = dev;
185686beb464996 Herve Codina 2024-10-14 172
185686beb464996 Herve Codina 2024-10-14 173 ret = lan966x_pci_load_overlay(data);
185686beb464996 Herve Codina 2024-10-14 174 if (ret)
185686beb464996 Herve Codina 2024-10-14 175 return ret;
185686beb464996 Herve Codina 2024-10-14 176
185686beb464996 Herve Codina 2024-10-14 177 pci_set_master(pdev);
185686beb464996 Herve Codina 2024-10-14 178
185686beb464996 Herve Codina 2024-10-14 179 ret = of_platform_default_populate(dev_of_node(dev), NULL, dev);
185686beb464996 Herve Codina 2024-10-14 180 if (ret)
6b5a5043c64e00b Pengpeng Hou 2026-06-16 181 goto err_depopulate;
185686beb464996 Herve Codina 2024-10-14 182
185686beb464996 Herve Codina 2024-10-14 183 return 0;
185686beb464996 Herve Codina 2024-10-14 184
6b5a5043c64e00b Pengpeng Hou 2026-06-16 185 err_depopulate:
6b5a5043c64e00b Pengpeng Hou 2026-06-16 186 of_platform_depopulate(dev);
185686beb464996 Herve Codina 2024-10-14 @187 err_unload_overlay:
185686beb464996 Herve Codina 2024-10-14 188 lan966x_pci_unload_overlay(data);
185686beb464996 Herve Codina 2024-10-14 189 return ret;
185686beb464996 Herve Codina 2024-10-14 190 }
185686beb464996 Herve Codina 2024-10-14 191
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [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