netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Paolo Abeni <pabeni@redhat.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	Linu Cherian <lcherian@marvell.com>,
	Geetha sowjanya <gakula@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>, hariprasad <hkelam@marvell.com>,
	Subbaraya Sundeep <sbhatta@marvell.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
	error27@gmail.com
Subject: Re: [PATCH] Octeontx2-af: Fix missing error code in cgx_probe()
Date: Tue, 14 Oct 2025 15:33:08 +0530	[thread overview]
Message-ID: <9d1ecea4-c63c-4627-8512-98af3153b357@oracle.com> (raw)
In-Reply-To: <2b9e0f15-6e4f-4510-91b6-8e4586e5f665@redhat.com>

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
> 


  reply	other threads:[~2025-10-14 10:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-10-14 10:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d1ecea4-c63c-4627-8512-98af3153b357@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=error27@gmail.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).