* Alex Williamson <alex.william...@redhat.com> [2017-05-11 15:49:04 -0600]:
Hi Alex, [...] > > diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c > > index 7ddcfd7..6760cee 100644 > > --- a/hw/vfio/ccw.c > > +++ b/hw/vfio/ccw.c [...] > > +static void vfio_ccw_register_io_notifier(VFIOCCWDevice *vcdev, Error > > **errp) > > +{ > > + VFIODevice *vdev = &vcdev->vdev; > > + struct vfio_irq_info *irq_info; > > + struct vfio_irq_set *irq_set; > > + size_t argsz; > > + int32_t *pfd; > > + > > + if (vdev->num_irqs < VFIO_CCW_IO_IRQ_INDEX + 1) { > > + error_setg(errp, "vfio: unexpected number of io irqs %u", > > + vdev->num_irqs); > > + return; > > + } > > + > > + argsz = sizeof(*irq_set); > > + irq_info = g_malloc0(argsz); > > + irq_info->index = VFIO_CCW_IO_IRQ_INDEX; > > + irq_info->argsz = argsz; > > + if (ioctl(vdev->fd, VFIO_DEVICE_GET_IRQ_INFO, > > + irq_info) < 0 || irq_info->count < 1) { > > + error_setg_errno(errp, errno, "vfio: Error getting irq info"); > > + goto get_error; > > + } > > + > > + if (event_notifier_init(&vcdev->io_notifier, 0)) { > > + error_setg_errno(errp, errno, > > + "vfio: Unable to init event notifier for IO"); > > + goto get_error; > > + } > > + > > + argsz = sizeof(*irq_set) + sizeof(*pfd); > > + irq_set = g_malloc0(argsz); > > + irq_set->argsz = argsz; > > + irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | > > + VFIO_IRQ_SET_ACTION_TRIGGER; > > + irq_set->index = VFIO_CCW_IO_IRQ_INDEX; > > + irq_set->start = 0; > > + irq_set->count = 1; > > + pfd = (int32_t *) &irq_set->data; > > + > > + *pfd = event_notifier_get_fd(&vcdev->io_notifier); > > + qemu_set_fd_handler(*pfd, vfio_ccw_io_notifier_handler, NULL, vcdev); > > + if (ioctl(vdev->fd, VFIO_DEVICE_SET_IRQS, irq_set)) { > > + error_setg(errp, "vfio: Failed to set up io notification"); > > + qemu_set_fd_handler(*pfd, NULL, NULL, vcdev); > > + event_notifier_cleanup(&vcdev->io_notifier); > > + goto set_error; > > > nit, unnecessary goto here. set_error label is unused if removed. Ok, I will remove both this goto line and the set_error label line! > > Otherwise, > > Acked-by: Alex Williamson <alex.william...@redhat.com> > > Thanks for all of your A-Bs! I will add them in next version. > > + } > > + > > +set_error: > > + g_free(irq_set); > > + > > +get_error: > > + g_free(irq_info); > > +} > > + [...] -- Dong Jia Shi