Skip to content

Commit 4935063

Browse files
fuyongjiewenlingz
authored andcommitted
DM: virtio-gpio: fixed static variable keeps increasing issue
virtio_gpio_ops variable type is static,so use "+=" will let the value keep increasing when acrn-dm reset. Tracked-On: #3118 Reviewed-by: Yuan Liu <yuan1.liu@intel.com> Signed-off-by: fuyongjie <fuyongjie@neusoft.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent 865ee29 commit 4935063

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

devicemodel/hw/pci/virtio/virtio_gpio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ virtio_gpio_cfgread(void *vdev, int offset, int size, uint32_t *retval)
620620
static struct virtio_ops virtio_gpio_ops = {
621621
"virtio_gpio", /* our name */
622622
VIRTIO_GPIO_MAXQ, /* we support VTGPIO_MAXQ virtqueues */
623-
sizeof(struct virtio_gpio_config), /* config reg size */
623+
0, /* config reg size */
624624
virtio_gpio_reset, /* reset */
625625
NULL, /* device-wide qnotify */
626626
virtio_gpio_cfgread, /* read virtio config */
@@ -1374,7 +1374,7 @@ virtio_gpio_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
13741374
}
13751375

13761376
/* Allocate PIO space for GPIO */
1377-
virtio_gpio_ops.cfgsize += GPIO_PIO_SIZE;
1377+
virtio_gpio_ops.cfgsize = sizeof(struct virtio_gpio_config) + GPIO_PIO_SIZE;
13781378

13791379
/* use BAR 0 to map config regs in IO space */
13801380
virtio_set_io_bar(&gpio->base, 0);

0 commit comments

Comments
 (0)