|
@@ -77,7 +77,7 @@ static void vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,
|
|
size_t argsz;
|
|
size_t argsz;
|
|
IOHandler *fd_read;
|
|
IOHandler *fd_read;
|
|
EventNotifier *notifier;
|
|
EventNotifier *notifier;
|
|
- struct vfio_irq_info *irq_info;
|
|
|
|
|
|
+ g_autofree struct vfio_irq_info *irq_info = NULL;
|
|
VFIODevice *vdev = &vapdev->vdev;
|
|
VFIODevice *vdev = &vapdev->vdev;
|
|
|
|
|
|
switch (irq) {
|
|
switch (irq) {
|
|
@@ -104,14 +104,14 @@ static void vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,
|
|
if (ioctl(vdev->fd, VFIO_DEVICE_GET_IRQ_INFO,
|
|
if (ioctl(vdev->fd, VFIO_DEVICE_GET_IRQ_INFO,
|
|
irq_info) < 0 || irq_info->count < 1) {
|
|
irq_info) < 0 || irq_info->count < 1) {
|
|
error_setg_errno(errp, errno, "vfio: Error getting irq info");
|
|
error_setg_errno(errp, errno, "vfio: Error getting irq info");
|
|
- goto out_free_info;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
if (event_notifier_init(notifier, 0)) {
|
|
if (event_notifier_init(notifier, 0)) {
|
|
error_setg_errno(errp, errno,
|
|
error_setg_errno(errp, errno,
|
|
"vfio: Unable to init event notifier for irq (%d)",
|
|
"vfio: Unable to init event notifier for irq (%d)",
|
|
irq);
|
|
irq);
|
|
- goto out_free_info;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
fd = event_notifier_get_fd(notifier);
|
|
fd = event_notifier_get_fd(notifier);
|
|
@@ -122,10 +122,6 @@ static void vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,
|
|
qemu_set_fd_handler(fd, NULL, NULL, vapdev);
|
|
qemu_set_fd_handler(fd, NULL, NULL, vapdev);
|
|
event_notifier_cleanup(notifier);
|
|
event_notifier_cleanup(notifier);
|
|
}
|
|
}
|
|
-
|
|
|
|
-out_free_info:
|
|
|
|
- g_free(irq_info);
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static void vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev,
|
|
static void vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev,
|