Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but there is a missing explicit `pci_free_irq_vectors()` on error paths and during device removal after a successful `pci_alloc_irq_vectors()` call, violating PCI subsystem guidelines.
--
--- Patch [2]: [PATCH v6 2/8] PCI: vmd: Add vmd_configure_cfgbar() helper function ---
commit bf3d098aa64842079a8c08e82a92ab1a8a2d4175
Author: Szymon Durawa <[email protected]>
PCI: vmd: Add vmd_configure_cfgbar() helper function
Move the VMD CFGBAR initialization code to a new helper
vmd_configure_cfgbar(). No functional changes.
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 070b247b3fbbe..2c824660cabd5 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
[ ... ]
> @@ -857,13 +869,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
> return ret;
> }
>
> - res = &vmd->dev->resource[VMD_CFGBAR];
> - vmd->resources[0] = (struct resource) {
> - .name = "VMD CFGBAR",
> - .start = vmd->busn_start,
> - .end = vmd->busn_start + (resource_size(res) >> 20) - 1,
> - .flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED,
> - };
> + vmd_configure_cfgbar(vmd);
[Severity: High]
This isn't a bug introduced by this patch, but while looking at
vmd_enable_domain() I noticed we might be leaking IRQ resources on error paths.
Earlier during setup, vmd_alloc_irqs() successfully calls
pci_alloc_irq_vectors(). However, if an error occurs later in
vmd_enable_domain(), the error paths exit like this:
pci_bus_release_emul_domain_nr(sd->domain);
pci_free_resource_list(&resources);
vmd_remove_irq_domain(vmd);
return -ENODEV;
Should there be a call to pci_free_irq_vectors() before returning to avoid
leaking vectors and potentially exhausting system IRQ capacity?
Similarly, the device removal logic in vmd_remove() also appears to omit the
pci_free_irq_vectors() cleanup step entirely. Does the driver need a manual
cleanup step here as well?
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.