Re: [PATCH -next] RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 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@xxxxxxxxxx>
---
  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@xxxxxxxxx>

Zhu Yanjun

+		usnic_err("Failed to discover pf of vnic %s with err%d\n",
+				pci_name(pdev), err);
  		goto out_clean_vnic;
  	}





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux