On Tue, 29 Oct 2019 at 23:01, Michael S. Tsirkin <m...@redhat.com> wrote:
>
> From: Jens Freimann <jfreim...@redhat.com>
>
> As usual block all vfio-pci devices from being migrated, but make an
> exception for failover primary devices. This is achieved by setting
> unmigratable to 0 but also add a migration blocker for all vfio-pci
> devices except failover primary devices. These will be unplugged before
> migration happens by the migration handler of the corresponding
> virtio-net standby device.

Hi; Coverity reports a 'value written to variable but never used'
issue here (CID 1407219):


> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 12fac39804..e6569a7968 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -40,6 +40,7 @@
>  #include "pci.h"
>  #include "trace.h"
>  #include "qapi/error.h"
> +#include "migration/blocker.h"
>
>  #define TYPE_VFIO_PCI "vfio-pci"
>  #define PCI_VFIO(obj)    OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI)
> @@ -2732,6 +2733,17 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
>          return;
>      }
>
> +    if (!pdev->failover_pair_id) {
> +        error_setg(&vdev->migration_blocker,
> +                "VFIO device doesn't support migration");
> +        ret = migrate_add_blocker(vdev->migration_blocker, &err);

Here we assign to 'ret', but we never use it on the 'if (err)'
path, and on the success case we don't look at it either; it's
just overwritten by the later 'ret = vfio_get_device(...)'.

> +        if (err) {
> +            error_propagate(errp, err);
> +            error_free(vdev->migration_blocker);
> +            return;
> +        }
> +    }

thanks
-- PMM

Reply via email to