Commit 6c3b1f08 authored by Yuan Can's avatar Yuan Can Committed by Wen Zhiwei
Browse files

vDPA/ifcvf: Fix pci_read_config_byte() return code handling

stable inclusion
from stable-v6.6.62
commit 6fbf6ff7549e65e150dede357c47445b149c4cc6
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB5BUT

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6fbf6ff7549e65e150dede357c47445b149c4cc6



--------------------------------

[ 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: 5a2414bc ("virtio: Intel IFC VF driver for VDPA")
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
Message-Id: <20241017013812.129952-1-yuancan@huawei.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarZhu Lingshan <lingshan.zhu@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 16f42ab6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,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;
	}