From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Yue Haibing <yuehaibing@huawei.com>,
benve@cisco.com, neescoba@cisco.com, jgg@ziepe.ca,
leon@kernel.org, liyuyu6@huawei.com, umalhi@cisco.com,
roland@purestorage.com
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()
Date: Sun, 23 Mar 2025 08:53:50 +0100 [thread overview]
Message-ID: <6d37fe4e-91ed-4b65-b729-5de69e8655a2@linux.dev> (raw)
In-Reply-To: <20250323033414.1716788-1-yuehaibing@huawei.com>
在 2025/3/23 4:34, Yue Haibing 写道:
> drivers/infiniband/hw/usnic/usnic_ib_main.c:590
> usnic_ib_pci_probe() warn: passing zero to 'PTR_ERR'
>
> Use err code in usnic_err() to fix this.
>
> Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
> drivers/infiniband/hw/usnic/usnic_ib_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> index 4ddcd5860e0f..e40370f9ff25 100644
> --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
> +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> @@ -587,9 +587,9 @@ static int usnic_ib_pci_probe(struct pci_dev *pdev,
>
> pf = usnic_ib_discover_pf(vf->vnic);
> if (IS_ERR_OR_NULL(pf)) {
> - usnic_err("Failed to discover pf of vnic %s with err%ld\n",
> - pci_name(pdev), PTR_ERR(pf));
> err = pf ? PTR_ERR(pf) : -EFAULT;
When pf is NULL, PTR_ERR(pf) will warn "passing zero to PTR_ERR". Thus,
if pf is NULL, the err will be set to -EFAULT.
But from the current implementation of "static struct usnic_ib_dev
*usnic_ib_discover_pf(struct usnic_vnic *vnic)", it seems that pf can
not be set to NULL.
But this commit can prevent this warning when the implementation of
usnic_ib_discover_pf will be changed in the future.
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Zhu Yanjun
> + usnic_err("Failed to discover pf of vnic %s with err%d\n",
> + pci_name(pdev), err);
> goto out_clean_vnic;
> }
>
next prev parent reply other threads:[~2025-03-23 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-23 3:34 [PATCH -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe() Yue Haibing
2025-03-23 7:53 ` Zhu Yanjun [this message]
2025-03-23 13:13 ` Jason Gunthorpe
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=6d37fe4e-91ed-4b65-b729-5de69e8655a2@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=benve@cisco.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=liyuyu6@huawei.com \
--cc=neescoba@cisco.com \
--cc=roland@purestorage.com \
--cc=umalhi@cisco.com \
--cc=yuehaibing@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.