* [PATCH next] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain()
@ 2023-10-30 7:27 Harshit Mogalapalli
2024-01-06 11:39 ` Krzysztof Wilczyński
2024-01-08 18:27 ` Krzysztof Wilczyński
0 siblings, 2 replies; 3+ messages in thread
From: Harshit Mogalapalli @ 2023-10-30 7:27 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Michal Simek, Thippeswamy Havalige,
Bharat Kumar Gogada, linux-pci, linux-arm-kernel, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
Return -ENOMEM instead of zero(success) when it fails to get IRQ domain.
Fixes: 8d786149d78c ("PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is found with smatch and the patch is only compile tested.
---
drivers/pci/controller/pcie-xilinx-dma-pl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-xilinx-dma-pl.c b/drivers/pci/controller/pcie-xilinx-dma-pl.c
index 2f7d676c683c..52f3211d11cd 100644
--- a/drivers/pci/controller/pcie-xilinx-dma-pl.c
+++ b/drivers/pci/controller/pcie-xilinx-dma-pl.c
@@ -576,7 +576,7 @@ static int xilinx_pl_dma_pcie_init_irq_domain(struct pl_dma_pcie *port)
&intx_domain_ops, port);
if (!port->intx_domain) {
dev_err(dev, "Failed to get a INTx IRQ domain\n");
- return PTR_ERR(port->intx_domain);
+ return -ENOMEM;
}
irq_domain_update_bus_token(port->intx_domain, DOMAIN_BUS_WIRED);
--
2.39.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain()
2023-10-30 7:27 [PATCH next] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain() Harshit Mogalapalli
@ 2024-01-06 11:39 ` Krzysztof Wilczyński
2024-01-08 18:27 ` Krzysztof Wilczyński
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2024-01-06 11:39 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas, Michal Simek,
Thippeswamy Havalige, Bharat Kumar Gogada, linux-pci,
linux-arm-kernel, linux-kernel, dan.carpenter, kernel-janitors,
error27
Hello,
> Return -ENOMEM instead of zero(success) when it fails to get IRQ domain.
>
> Fixes: 8d786149d78c ("PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is found with smatch and the patch is only compile tested.
> ---
> drivers/pci/controller/pcie-xilinx-dma-pl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-xilinx-dma-pl.c b/drivers/pci/controller/pcie-xilinx-dma-pl.c
> index 2f7d676c683c..52f3211d11cd 100644
> --- a/drivers/pci/controller/pcie-xilinx-dma-pl.c
> +++ b/drivers/pci/controller/pcie-xilinx-dma-pl.c
> @@ -576,7 +576,7 @@ static int xilinx_pl_dma_pcie_init_irq_domain(struct pl_dma_pcie *port)
> &intx_domain_ops, port);
> if (!port->intx_domain) {
> dev_err(dev, "Failed to get a INTx IRQ domain\n");
> - return PTR_ERR(port->intx_domain);
> + return -ENOMEM;
> }
This looks good.
However, there is probably another issue here on the failure path. I don't
see any of_node_put() to release the pcie_intc_node taken at the top of the
xilinx_pl_dma_pcie_init_irq_domain() function.
I would imagine a similar approach to the error handling as what we can see
from xilinx_cpm_pcie_init_irq_domain() function in the older driver.
Thippeswamy, can you have a look and see if this can be improved? I would
love to get a fix before Bjorn sends a Pull Request for the next release.
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain()
2023-10-30 7:27 [PATCH next] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain() Harshit Mogalapalli
2024-01-06 11:39 ` Krzysztof Wilczyński
@ 2024-01-08 18:27 ` Krzysztof Wilczyński
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2024-01-08 18:27 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas, Michal Simek,
Thippeswamy Havalige, Bharat Kumar Gogada, linux-pci,
linux-arm-kernel, linux-kernel, dan.carpenter, kernel-janitors,
error27
Hello,
> Return -ENOMEM instead of zero(success) when it fails to get IRQ domain.
Applied to controller/xilinx, thank you!
[1/1] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain()
https://git.kernel.org/pci/pci/c/2324be17b5e0
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-08 18:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-30 7:27 [PATCH next] PCI: xilinx-xdma: Fix error code in xilinx_pl_dma_pcie_init_irq_domain() Harshit Mogalapalli
2024-01-06 11:39 ` Krzysztof Wilczyński
2024-01-08 18:27 ` Krzysztof Wilczyński
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).