]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
virtio: pci: Fix discovery of device config length
authorAndrew Scull <ascull@google.com>
Thu, 21 Apr 2022 16:11:00 +0000 (16:11 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 3 May 2022 19:50:45 +0000 (15:50 -0400)
The length of the device config was erroneously being taken from the
notify capability. Correct this by finding the length in the device
capability.

Fixes: 550435edf810 ("virtio: pci: Support non-legacy PCI transport device")
Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/virtio/virtio_pci_modern.c

index fd8a1f3fecb176e96b7bb67546ac4a277ca57057..55d25cb81b95523aebc16370ad1bd91bec36dbfd 100644 (file)
@@ -497,7 +497,7 @@ static int virtio_pci_probe(struct udevice *udev)
         */
        device = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_DEVICE_CFG);
        if (device) {
-               offset = notify + offsetof(struct virtio_pci_cap, length);
+               offset = device + offsetof(struct virtio_pci_cap, length);
                dm_pci_read_config32(udev, offset, &priv->device_len);
        }