aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-04-02 11:53:18 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-04-02 11:53:19 +0100
commit11577d85b1a6939380bd16ed9a861653194de044 (patch)
tree34bc6d68a0b62f096b10fd1660d99b4ef358d441 /hw/virtio
parent50a9b4499ca99a439b400f715f9475b1702f4e87 (diff)
parent8ddf54324858ce5e35272efa449f27fc0a19f957 (diff)
downloadqemu-11577d85b1a6939380bd16ed9a861653194de044.zip
qemu-11577d85b1a6939380bd16ed9a861653194de044.tar.gz
qemu-11577d85b1a6939380bd16ed9a861653194de044.tar.bz2
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc,virtio,pci: bugfixes Fixes all over the place. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Thu 01 Apr 2021 17:22:03 BST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: pci: sprinkle assert in PCI pin number isa/v582c686: Reinitialize ACPI PM device on reset vt82c686.c: don't raise SCI when PCI_INTERRUPT_PIN isn't setup acpi/piix4: reinitialize acpi PM device on reset virtio-pci: remove explicit initialization of val virtio-pci: add check for vdev in virtio_pci_isr_read vhost-user-blk: add immediate cleanup on shutdown vhost-user-blk: perform immediate cleanup if disconnect on initialization vhost-user-blk: use different event handlers on initialization Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio-pci.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 883045a..c1b67cf 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1364,9 +1364,14 @@ static uint64_t virtio_pci_isr_read(void *opaque, hwaddr addr,
{
VirtIOPCIProxy *proxy = opaque;
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
- uint64_t val = qatomic_xchg(&vdev->isr, 0);
- pci_irq_deassert(&proxy->pci_dev);
+ uint64_t val;
+
+ if (vdev == NULL) {
+ return 0;
+ }
+ val = qatomic_xchg(&vdev->isr, 0);
+ pci_irq_deassert(&proxy->pci_dev);
return val;
}
@@ -1380,10 +1385,10 @@ static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr,
{
VirtIOPCIProxy *proxy = opaque;
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
- uint64_t val = 0;
+ uint64_t val;
if (vdev == NULL) {
- return val;
+ return 0;
}
switch (size) {
@@ -1396,6 +1401,9 @@ static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr,
case 4:
val = virtio_config_modern_readl(vdev, addr);
break;
+ default:
+ val = 0;
+ break;
}
return val;
}