Reviewed-by: Raphael Norwitz <raphael.s.norwitz@gmail.com>
On Wed, Aug 13, 2025 at 12:52 PM Vladimir Sementsov-Ogievskiy
<vsementsov@yandex-team.ru> wrote:
>
> The logic kept as is. Reaftor to simplify further changes.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> hw/virtio/virtio-bus.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
> index 11adfbf3ab..c7e3941b1e 100644
> --- a/hw/virtio/virtio-bus.c
> +++ b/hw/virtio/virtio-bus.c
> @@ -293,20 +293,18 @@ int virtio_bus_set_host_notifier(VirtioBusState *bus, int n, bool assign)
> __func__, strerror(-r), r);
> return r;
> }
> - r = k->ioeventfd_assign(proxy, notifier, n, true);
> - if (r < 0) {
> - error_report("%s: unable to assign ioeventfd: %d", __func__, r);
> - virtio_bus_cleanup_host_notifier(bus, n);
> - }
> - } else {
> - k->ioeventfd_assign(proxy, notifier, n, false);
> }
>
> - if (r == 0) {
> - virtio_queue_set_host_notifier_enabled(vq, assign);
> + r = k->ioeventfd_assign(proxy, notifier, n, assign);
> + if (r < 0 && assign) {
> + error_report("%s: unable to assign ioeventfd: %d", __func__, r);
> + virtio_bus_cleanup_host_notifier(bus, n);
> + return r;
> }
>
> - return r;
> + virtio_queue_set_host_notifier_enabled(vq, assign);
> +
> + return 0;
> }
>
> void virtio_bus_cleanup_host_notifier(VirtioBusState *bus, int n)
> --
> 2.48.1
>
>