Message ID | 20250224155025.782179-2-thippeswamy.havalige@amd.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Krzysztof Wilczyński |
Headers | show |
Series | Add support for Versal Net CPM5N Root Port controller | expand |
[AMD Official Use Only - AMD Internal Distribution Only] Hi Manivannan/Bjorn, Can you please provide update on this patch. Regards, Thippeswamy H > -----Original Message----- > From: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > Sent: Monday, February 24, 2025 9:20 PM > To: bhelgaas@google.com; lpieralisi@kernel.org; kw@linux.com; > manivannan.sadhasivam@linaro.org; robh@kernel.org; krzk+dt@kernel.org; > conor+dt@kernel.org > Cc: linux-pci@vger.kernel.org; devicetree@vger.kernel.org; linux- > kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>; Gogada, > Bharat Kumar <bharat.kumar.gogada@amd.com>; Havalige, Thippeswamy > <thippeswamy.havalige@amd.com> > Subject: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of > probe. > > The IRQ domain allocated for the PCIe controller is not freed if > resource_list_first_type returns NULL, leading to a resource leak. > > This fix ensures properly cleaning up the allocated IRQ domain in the error > path. > > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > --- > drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c > b/drivers/pci/controller/pcie-xilinx-cpm.c > index 81e8bfae53d0..660b12fc4631 100644 > --- a/drivers/pci/controller/pcie-xilinx-cpm.c > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c > @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct > platform_device *pdev) > return err; > > bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); > - if (!bus) > + if (!bus) { > + xilinx_cpm_free_irq_domains(port); > return -ENODEV; > + } > > port->variant = of_device_get_match_data(dev); > > -- > 2.43.0
On Mon, Feb 24, 2025 at 09:20:22PM +0530, Thippeswamy Havalige wrote: > The IRQ domain allocated for the PCIe controller is not freed if > resource_list_first_type returns NULL, leading to a resource leak. > > This fix ensures properly cleaning up the allocated IRQ domain in the error > path. > Missing Fixes tag. > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > --- > drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c > index 81e8bfae53d0..660b12fc4631 100644 > --- a/drivers/pci/controller/pcie-xilinx-cpm.c > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c > @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev) > return err; > > bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); > - if (!bus) > + if (!bus) { > + xilinx_cpm_free_irq_domains(port); Why can't you use existing 'err_parse_dt' label? If the reason is the name, just change it to actual error case. Like, 'err_free_irq_domains'. - Mani
Hello, [...] > > The IRQ domain allocated for the PCIe controller is not freed if > > resource_list_first_type returns NULL, leading to a resource leak. > > > > This fix ensures properly cleaning up the allocated IRQ domain in the error > > path. > > > > Missing Fixes tag. Done. > > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > > --- > > drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c > > index 81e8bfae53d0..660b12fc4631 100644 > > --- a/drivers/pci/controller/pcie-xilinx-cpm.c > > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c > > @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev) > > return err; > > > > bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); > > - if (!bus) > > + if (!bus) { > > + xilinx_cpm_free_irq_domains(port); > > Why can't you use existing 'err_parse_dt' label? If the reason is the name, just > change it to actual error case. Like, 'err_free_irq_domains'. Done. I took care of the review feedback and added missing "Fixes:" tag, and changed the code to use an existing goto label. Both changes are already on the branch. Thank you! Krzysztof
[AMD Official Use Only - AMD Internal Distribution Only] > -----Original Message----- > From: Krzysztof Wilczyński <kw@linux.com> > Sent: Sunday, March 9, 2025 11:05 PM > To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > Cc: Havalige, Thippeswamy <thippeswamy.havalige@amd.com>; > bhelgaas@google.com; lpieralisi@kernel.org; robh@kernel.org; > krzk+dt@kernel.org; conor+dt@kernel.org; linux-pci@vger.kernel.org; > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; Simek, Michal > <michal.simek@amd.com>; Gogada, Bharat Kumar > <bharat.kumar.gogada@amd.com> > Subject: Re: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of > probe. > > Hello, > > [...] > > > The IRQ domain allocated for the PCIe controller is not freed if > > > resource_list_first_type returns NULL, leading to a resource leak. > > > > > > This fix ensures properly cleaning up the allocated IRQ domain in > > > the error path. > > > > > > > Missing Fixes tag. > > Done. > > > > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > > > --- > > > drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c > > > b/drivers/pci/controller/pcie-xilinx-cpm.c > > > index 81e8bfae53d0..660b12fc4631 100644 > > > --- a/drivers/pci/controller/pcie-xilinx-cpm.c > > > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c > > > @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct > platform_device *pdev) > > > return err; > > > > > > bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); > > > - if (!bus) > > > + if (!bus) { > > > + xilinx_cpm_free_irq_domains(port); > > > > Why can't you use existing 'err_parse_dt' label? If the reason is the > > name, just change it to actual error case. Like, 'err_free_irq_domains'. > > Done. > > I took care of the review feedback and added missing "Fixes:" tag, and changed > the code to use an existing goto label. Both changes are already on the branch. > > Thank you! Thank you, Krzysztof for making changes & applying patches. > > Krzysztof
diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c index 81e8bfae53d0..660b12fc4631 100644 --- a/drivers/pci/controller/pcie-xilinx-cpm.c +++ b/drivers/pci/controller/pcie-xilinx-cpm.c @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev) return err; bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); - if (!bus) + if (!bus) { + xilinx_cpm_free_irq_domains(port); return -ENODEV; + } port->variant = of_device_get_match_data(dev);
The IRQ domain allocated for the PCIe controller is not freed if resource_list_first_type returns NULL, leading to a resource leak. This fix ensures properly cleaning up the allocated IRQ domain in the error path. Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> --- drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)