mirror of https://github.com/xemu-project/xemu.git
vfio/ccw: Use g_autofree variable in vfio_ccw_register_irq_notifier()
Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Farman <farman@linux.ibm.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
cbd470f0aa
commit
04f8e4f29b
|
@ -384,7 +384,7 @@ static void vfio_ccw_register_irq_notifier(VFIOCCWDevice *vcdev,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
VFIODevice *vdev = &vcdev->vdev;
|
VFIODevice *vdev = &vcdev->vdev;
|
||||||
struct vfio_irq_info *irq_info;
|
g_autofree struct vfio_irq_info *irq_info = NULL;
|
||||||
size_t argsz;
|
size_t argsz;
|
||||||
int fd;
|
int fd;
|
||||||
EventNotifier *notifier;
|
EventNotifier *notifier;
|
||||||
|
@ -421,14 +421,14 @@ static void vfio_ccw_register_irq_notifier(VFIOCCWDevice *vcdev,
|
||||||
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);
|
||||||
|
@ -439,9 +439,6 @@ static void vfio_ccw_register_irq_notifier(VFIOCCWDevice *vcdev,
|
||||||
qemu_set_fd_handler(fd, NULL, NULL, vcdev);
|
qemu_set_fd_handler(fd, NULL, NULL, vcdev);
|
||||||
event_notifier_cleanup(notifier);
|
event_notifier_cleanup(notifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
out_free_info:
|
|
||||||
g_free(irq_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_ccw_unregister_irq_notifier(VFIOCCWDevice *vcdev,
|
static void vfio_ccw_unregister_irq_notifier(VFIOCCWDevice *vcdev,
|
||||||
|
|
Loading…
Reference in New Issue