David Hamilton <[email protected]> writes:

> setup_interrupt() can fail and report via errp, but
> process_msg_connect() was ignoring the error and continuing
> to ivshmem_add_eventfd(). Check the bool return to avoid
> operating on a vector whose interrupt setup failed.
>
> Resolves the TODO comment at the call site.
>
> Signed-off-by: David Hamilton <[email protected]>
> ---
>  hw/misc/ivshmem-pci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/misc/ivshmem-pci.c b/hw/misc/ivshmem-pci.c
> index c987eebb98..f1262fa5f7 100644
> --- a/hw/misc/ivshmem-pci.c
> +++ b/hw/misc/ivshmem-pci.c
> @@ -553,8 +553,9 @@ static void process_msg_connect(IVShmemState *s, uint16_t 
> posn, int fd,
>      }
>  
>      if (posn == s->vm_id) {
> -        setup_interrupt(s, vector, errp);
> -        /* TODO do we need to handle the error? */
> +        if (!setup_interrupt(s, vector, errp)) {

Any cleanup needed here?  Error returns above close(fd).

> +            return;
> +        }
>      }
>  
>      if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {


Reply via email to