* [PATCH v2 -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()
@ 2025-03-24 12:31 Yue Haibing
2025-03-25 13:55 ` Jason Gunthorpe
2025-04-07 18:09 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Yue Haibing @ 2025-03-24 12:31 UTC (permalink / raw)
To: benve, neescoba, jgg, leon, liyuyu6, roland, umalhi
Cc: linux-rdma, linux-kernel, yuehaibing, yanjun.zhu
drivers/infiniband/hw/usnic/usnic_ib_main.c:590
usnic_ib_pci_probe() warn: passing zero to 'PTR_ERR'
Make usnic_ib_device_add() return NULL on fail path, also remove
useless NULL check for usnic_ib_discover_pf()
Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
v2: remove useless null check for usnic_ib_discover_pf
---
drivers/infiniband/hw/usnic/usnic_ib_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 4ddcd5860e0f..11eca39b73a9 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -397,7 +397,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
if (!us_ibdev) {
usnic_err("Device %s context alloc failed\n",
netdev_name(pci_get_drvdata(dev)));
- return ERR_PTR(-EFAULT);
+ return NULL;
}
us_ibdev->ufdev = usnic_fwd_dev_alloc(dev);
@@ -517,8 +517,8 @@ static struct usnic_ib_dev *usnic_ib_discover_pf(struct usnic_vnic *vnic)
}
us_ibdev = usnic_ib_device_add(parent_pci);
- if (IS_ERR_OR_NULL(us_ibdev)) {
- us_ibdev = us_ibdev ? us_ibdev : ERR_PTR(-EFAULT);
+ if (!us_ibdev) {
+ us_ibdev = ERR_PTR(-EFAULT);
goto out;
}
@@ -586,10 +586,10 @@ 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;
+ if (IS_ERR(pf)) {
+ err = PTR_ERR(pf);
+ usnic_err("Failed to discover pf of vnic %s with err%d\n",
+ pci_name(pdev), err);
goto out_clean_vnic;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()
2025-03-24 12:31 [PATCH v2 -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe() Yue Haibing
@ 2025-03-25 13:55 ` Jason Gunthorpe
2025-04-07 18:09 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2025-03-25 13:55 UTC (permalink / raw)
To: Yue Haibing
Cc: benve, neescoba, leon, liyuyu6, roland, umalhi, linux-rdma,
linux-kernel, yanjun.zhu
On Mon, Mar 24, 2025 at 08:31:32PM +0800, Yue Haibing wrote:
> drivers/infiniband/hw/usnic/usnic_ib_main.c:590
> usnic_ib_pci_probe() warn: passing zero to 'PTR_ERR'
>
> Make usnic_ib_device_add() return NULL on fail path, also remove
> useless NULL check for usnic_ib_discover_pf()
>
> Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> v2: remove useless null check for usnic_ib_discover_pf
> ---
> drivers/infiniband/hw/usnic/usnic_ib_main.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()
2025-03-24 12:31 [PATCH v2 -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe() Yue Haibing
2025-03-25 13:55 ` Jason Gunthorpe
@ 2025-04-07 18:09 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2025-04-07 18:09 UTC (permalink / raw)
To: Yue Haibing
Cc: benve, neescoba, leon, liyuyu6, roland, umalhi, linux-rdma,
linux-kernel, yanjun.zhu
On Mon, Mar 24, 2025 at 08:31:32PM +0800, Yue Haibing wrote:
> drivers/infiniband/hw/usnic/usnic_ib_main.c:590
> usnic_ib_pci_probe() warn: passing zero to 'PTR_ERR'
>
> Make usnic_ib_device_add() return NULL on fail path, also remove
> useless NULL check for usnic_ib_discover_pf()
>
> Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> v2: remove useless null check for usnic_ib_discover_pf
> ---
> drivers/infiniband/hw/usnic/usnic_ib_main.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Applied to for-rc, thanks
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-07 18:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-24 12:31 [PATCH v2 -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe() Yue Haibing
2025-03-25 13:55 ` Jason Gunthorpe
2025-04-07 18:09 ` Jason Gunthorpe
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).