* [PATCH v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check
@ 2025-10-15 9:01 Harshit Mogalapalli
2025-10-15 16:15 ` Simon Horman
2025-10-16 22:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Harshit Mogalapalli @ 2025-10-15 9:01 UTC (permalink / raw)
To: Sunil Goutham, Linu Cherian, Geetha sowjanya, Jerin Jacob,
hariprasad, Subbaraya Sundeep, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nithya Mani, netdev,
linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
In cgx_probe() when pci_alloc_irq_vectors() fails the error value will
be negative and that check is sufficient.
err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSIX);
if (err < 0 || err != nvec) {
...
}
When pci_alloc_irq_vectors() fail to allocate nvec number of vectors,
-ENOSPC is returned, so it would be safe to remove the check that
compares err with nvec.
Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
Only compile tested.
v1->v2: Improve the commit message
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index d374a4454836..f4d5a3c05fa4 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -1993,7 +1993,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
nvec = pci_msix_vec_count(cgx->pdev);
err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSIX);
- if (err < 0 || err != nvec) {
+ if (err < 0) {
dev_err(dev, "Request for %d msix vectors failed, err %d\n",
nvec, err);
goto err_release_regions;
--
2.39.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check
2025-10-15 9:01 [PATCH v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check Harshit Mogalapalli
@ 2025-10-15 16:15 ` Simon Horman
2025-10-16 22:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-10-15 16:15 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: Sunil Goutham, Linu Cherian, Geetha sowjanya, Jerin Jacob,
hariprasad, Subbaraya Sundeep, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nithya Mani, netdev,
linux-kernel, dan.carpenter, kernel-janitors, error27
On Wed, Oct 15, 2025 at 02:01:17AM -0700, Harshit Mogalapalli wrote:
> In cgx_probe() when pci_alloc_irq_vectors() fails the error value will
> be negative and that check is sufficient.
>
> err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSIX);
> if (err < 0 || err != nvec) {
> ...
> }
>
> When pci_alloc_irq_vectors() fail to allocate nvec number of vectors,
> -ENOSPC is returned, so it would be safe to remove the check that
> compares err with nvec.
>
> Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> Only compile tested.
>
> v1->v2: Improve the commit message
Thanks for the update.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check
2025-10-15 9:01 [PATCH v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check Harshit Mogalapalli
2025-10-15 16:15 ` Simon Horman
@ 2025-10-16 22:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-16 22:50 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta,
andrew+netdev, davem, edumazet, kuba, pabeni, nmani, netdev,
linux-kernel, dan.carpenter, kernel-janitors, error27
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 15 Oct 2025 02:01:17 -0700 you wrote:
> In cgx_probe() when pci_alloc_irq_vectors() fails the error value will
> be negative and that check is sufficient.
>
> err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSIX);
> if (err < 0 || err != nvec) {
> ...
> }
>
> [...]
Here is the summary with links:
- [v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check
https://git.kernel.org/netdev/net-next/c/e1048520750d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-16 22:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 9:01 [PATCH v2] Octeontx2-af: Fix pci_alloc_irq_vectors() return value check Harshit Mogalapalli
2025-10-15 16:15 ` Simon Horman
2025-10-16 22:50 ` patchwork-bot+netdevbpf
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).