* [PATCH] Octeontx2-af: Fix missing error code in cgx_probe()
@ 2025-10-10 20:42 Harshit Mogalapalli
2025-10-13 9:23 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Harshit Mogalapalli @ 2025-10-10 20:42 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, netdev, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
When CGX fails mapping to NIX, set the error code to -ENODEV, currently
err is zero and that is treated as success path.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aLAdlCg2_Yv7Y-3h@stanley.mountain/
Fixes: d280233fc866 ("Octeontx2-af: Fix NIX X2P calibration failures")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis with smatch and only compile tested.
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index d374a4454836..ec0e11c77cbf 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -1981,6 +1981,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
!is_cgx_mapped_to_nix(pdev->subsystem_device, cgx->cgx_id)) {
dev_notice(dev, "CGX %d not mapped to NIX, skipping probe\n",
cgx->cgx_id);
+ err = -ENODEV;
goto err_release_regions;
}
--
2.39.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() 2025-10-10 20:42 [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() Harshit Mogalapalli @ 2025-10-13 9:23 ` Simon Horman 2025-10-14 9:47 ` Paolo Abeni 2025-10-14 10:00 ` patchwork-bot+netdevbpf 2 siblings, 0 replies; 5+ messages in thread From: Simon Horman @ 2025-10-13 9:23 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, netdev, linux-kernel, dan.carpenter, kernel-janitors, error27 On Fri, Oct 10, 2025 at 01:42:39PM -0700, Harshit Mogalapalli wrote: > When CGX fails mapping to NIX, set the error code to -ENODEV, currently > err is zero and that is treated as success path. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Closes: https://lore.kernel.org/all/aLAdlCg2_Yv7Y-3h@stanley.mountain/ > Fixes: d280233fc866 ("Octeontx2-af: Fix NIX X2P calibration failures") > Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> > --- > This is based on static analysis with smatch and only compile tested. Thanks, I agree that Smatch is onto something here. Reviewed-by: Simon Horman <horms@kernel.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() 2025-10-10 20:42 [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() Harshit Mogalapalli 2025-10-13 9:23 ` Simon Horman @ 2025-10-14 9:47 ` Paolo Abeni 2025-10-14 10:03 ` Harshit Mogalapalli 2025-10-14 10:00 ` patchwork-bot+netdevbpf 2 siblings, 1 reply; 5+ messages in thread From: Paolo Abeni @ 2025-10-14 9:47 UTC (permalink / raw) To: Harshit Mogalapalli, Sunil Goutham, Linu Cherian, Geetha sowjanya, Jerin Jacob, hariprasad, Subbaraya Sundeep, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, netdev, linux-kernel Cc: dan.carpenter, kernel-janitors, error27 On 10/10/25 10:42 PM, Harshit Mogalapalli wrote: > When CGX fails mapping to NIX, set the error code to -ENODEV, currently > err is zero and that is treated as success path. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Closes: https://lore.kernel.org/all/aLAdlCg2_Yv7Y-3h@stanley.mountain/ > Fixes: d280233fc866 ("Octeontx2-af: Fix NIX X2P calibration failures") > Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> > --- > This is based on static analysis with smatch and only compile tested. > --- > drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c > index d374a4454836..ec0e11c77cbf 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c > +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c > @@ -1981,6 +1981,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) > !is_cgx_mapped_to_nix(pdev->subsystem_device, cgx->cgx_id)) { > dev_notice(dev, "CGX %d not mapped to NIX, skipping probe\n", > cgx->cgx_id); > + err = -ENODEV; > goto err_release_regions; > } > Side note, a few lines below there is this check: err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSIX); if (err < 0 || err != nvec) { dev_err(dev, "Request for %d msix vectors failed, err %d\n", nvec, err); goto err_release_regions; } AFAICS err can never be a positive value in that error path, but the if (err < 0 || err != nvec) check is confusing and should possibly be changed to: if (err < 0) /P ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() 2025-10-14 9:47 ` Paolo Abeni @ 2025-10-14 10:03 ` Harshit Mogalapalli 0 siblings, 0 replies; 5+ messages in thread From: Harshit Mogalapalli @ 2025-10-14 10:03 UTC (permalink / raw) To: Paolo Abeni, Sunil Goutham, Linu Cherian, Geetha sowjanya, Jerin Jacob, hariprasad, Subbaraya Sundeep, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, netdev, linux-kernel Cc: dan.carpenter, kernel-janitors, error27 Hi Paolo, On 14/10/25 15:17, Paolo Abeni wrote: > > > On 10/10/25 10:42 PM, Harshit Mogalapalli wrote: >> When CGX fails mapping to NIX, set the error code to -ENODEV, currently >> err is zero and that is treated as success path. >> >> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> >> Closes: https://lore.kernel.org/all/aLAdlCg2_Yv7Y-3h@stanley.mountain/ >> Fixes: d280233fc866 ("Octeontx2-af: Fix NIX X2P calibration failures") >> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> >> --- >> This is based on static analysis with smatch and only compile tested. >> --- >> drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c >> index d374a4454836..ec0e11c77cbf 100644 >> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c >> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c >> @@ -1981,6 +1981,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) >> !is_cgx_mapped_to_nix(pdev->subsystem_device, cgx->cgx_id)) { >> dev_notice(dev, "CGX %d not mapped to NIX, skipping probe\n", >> cgx->cgx_id); >> + err = -ENODEV; >> goto err_release_regions; >> } >> > > Side note, a few lines below there is this check: > > err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSIX); > if (err < 0 || err != nvec) { > dev_err(dev, "Request for %d msix vectors failed, err %d\n", > nvec, err); > goto err_release_regions; > } > > AFAICS err can never be a positive value in that error path, but the > > if (err < 0 || err != nvec) > > check is confusing and should possibly be changed to: > > if (err < 0) I agree, will send a patch for this. Thanks for the suggestion. Regards, Harshit> > /P > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() 2025-10-10 20:42 [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() Harshit Mogalapalli 2025-10-13 9:23 ` Simon Horman 2025-10-14 9:47 ` Paolo Abeni @ 2025-10-14 10:00 ` patchwork-bot+netdevbpf 2 siblings, 0 replies; 5+ messages in thread From: patchwork-bot+netdevbpf @ 2025-10-14 10:00 UTC (permalink / raw) To: Harshit Mogalapalli Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, andrew+netdev, davem, edumazet, kuba, pabeni, netdev, linux-kernel, dan.carpenter, kernel-janitors, error27 Hello: This patch was applied to netdev/net.git (main) by Paolo Abeni <pabeni@redhat.com>: On Fri, 10 Oct 2025 13:42:39 -0700 you wrote: > When CGX fails mapping to NIX, set the error code to -ENODEV, currently > err is zero and that is treated as success path. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Closes: https://lore.kernel.org/all/aLAdlCg2_Yv7Y-3h@stanley.mountain/ > Fixes: d280233fc866 ("Octeontx2-af: Fix NIX X2P calibration failures") > Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> > > [...] Here is the summary with links: - Octeontx2-af: Fix missing error code in cgx_probe() https://git.kernel.org/netdev/net/c/c5705a2a4aa3 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] 5+ messages in thread
end of thread, other threads:[~2025-10-14 10:04 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-10 20:42 [PATCH] Octeontx2-af: Fix missing error code in cgx_probe() Harshit Mogalapalli 2025-10-13 9:23 ` Simon Horman 2025-10-14 9:47 ` Paolo Abeni 2025-10-14 10:03 ` Harshit Mogalapalli 2025-10-14 10:00 ` 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).