vDPA/ifcvf: Fix pci_read_config_byte() return code handling
authorYuan Can <yuancan@huawei.com>
Thu, 17 Oct 2024 01:38:12 +0000 (09:38 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 6 Nov 2024 09:40:07 +0000 (04:40 -0500)
ifcvf_init_hw() uses pci_read_config_byte() that returns
PCIBIOS_* codes. The error handling, however, assumes the codes are
normal errnos because it checks for < 0.
Convert the error check to plain non-zero check.

Fixes: 5a2414bc454e ("virtio: Intel IFC VF driver for VDPA")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Message-Id: <20241017013812.129952-1-yuancan@huawei.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Zhu Lingshan <lingshan.zhu@kernel.org>
drivers/vdpa/ifcvf/ifcvf_base.c

index 472daa588a9d214aa1518530255afdc9a1919e1f..d5507b63b6cdb3ceca517daed87f7a395c9636d0 100644 (file)
@@ -108,7 +108,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)
        u32 i;
 
        ret = pci_read_config_byte(pdev, PCI_CAPABILITY_LIST, &pos);
-       if (ret < 0) {
+       if (ret) {
                IFCVF_ERR(pdev, "Failed to read PCI capability list\n");
                return -EIO;
        }