summaryrefslogtreecommitdiff
path: root/drivers/virtio
diff options
context:
space:
mode:
authorPeng Hao <flyingpenghao@gmail.com>2021-12-22 14:20:14 +0300
committerMichael S. Tsirkin <mst@redhat.com>2022-01-15 02:50:53 +0300
commit49814ce9e21a8b6d6158b2e502fe6bacef4d99b6 (patch)
treed1ac787912af65ca71984bc5138d082c2dd4277a /drivers/virtio
parentcf4a4493ff70874f8af26d75d4346c591c298e89 (diff)
downloadlinux-49814ce9e21a8b6d6158b2e502fe6bacef4d99b6.tar.xz
virtio/virtio_pci_legacy_dev: ensure the correct return value
When pci_iomap return NULL, the return value is zero. Signed-off-by: Peng Hao <flyingpeng@tencent.com> Link: https://lore.kernel.org/r/20211222112014.87394-1-flyingpeng@tencent.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_pci_legacy_dev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_pci_legacy_dev.c b/drivers/virtio/virtio_pci_legacy_dev.c
index 9b97680dd02b..677d1f68bc9b 100644
--- a/drivers/virtio/virtio_pci_legacy_dev.c
+++ b/drivers/virtio/virtio_pci_legacy_dev.c
@@ -45,8 +45,10 @@ int vp_legacy_probe(struct virtio_pci_legacy_device *ldev)
return rc;
ldev->ioaddr = pci_iomap(pci_dev, 0, 0);
- if (!ldev->ioaddr)
+ if (!ldev->ioaddr) {
+ rc = -EIO;
goto err_iomap;
+ }
ldev->isr = ldev->ioaddr + VIRTIO_PCI_ISR;