From b02aa56eb0def0bd89dcb3e48975ed6839955e8f Mon Sep 17 00:00:00 2001 From: Andrew Scull Date: Thu, 21 Apr 2022 16:11:00 +0000 Subject: [PATCH] virtio: pci: Fix discovery of device config length 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: a6de26e73e52 ("virtio: pci: Support non-legacy PCI transport device") Signed-off-by: Andrew Scull Reviewed-by: Bin Meng --- drivers/virtio/virtio_pci_modern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index fd8a1f3fec..55d25cb81b 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -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); } -- 2.39.5