summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuan Can <yuancan@huawei.com>2024-10-17 09:38:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-17 14:59:39 +0100
commit35b4795a7ebfe9c7a8f77c01936241d6bbf78c2d (patch)
tree7a9da67c1c4e06c1be7215f1111f2a7a4555185f
parent7e222d2c7f9ab06280110edd3b0c4340ff9f2a29 (diff)
downloadlinux-35b4795a7ebfe9c7a8f77c01936241d6bbf78c2d.tar.gz
linux-35b4795a7ebfe9c7a8f77c01936241d6bbf78c2d.tar.bz2
linux-35b4795a7ebfe9c7a8f77c01936241d6bbf78c2d.zip
vDPA/ifcvf: Fix pci_read_config_byte() return code handling
[ Upstream commit 7f8825b2a78ac392d3fbb3a2e65e56d9e39d75e9 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/vdpa/ifcvf/ifcvf_base.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c
index f2a128e56de5..b5724b88d42b 100644
--- a/drivers/vdpa/ifcvf/ifcvf_base.c
+++ b/drivers/vdpa/ifcvf/ifcvf_base.c
@@ -105,7 +105,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;
}