vfio: Avoid error_propagate() after migrate_add_blocker()

When migrate_add_blocker(blocker, &err) is followed by
error_propagate(errp, err), we can often just as well do
migrate_add_blocker(..., errp).  This is the case in
vfio_migration_probe().

Prior art: commit 386f6c07d2 "error: Avoid error_propagate() after
migrate_add_blocker()".

Cc: Kirti Wankhede <kwankhede@nvidia.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-8-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Markus Armbruster 2021-07-20 14:53:59 +02:00
parent a5c051b2cf
commit eb24a23e15

View File

@ -858,7 +858,6 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
{ {
VFIOContainer *container = vbasedev->group->container; VFIOContainer *container = vbasedev->group->container;
struct vfio_region_info *info = NULL; struct vfio_region_info *info = NULL;
Error *local_err = NULL;
int ret = -ENOTSUP; int ret = -ENOTSUP;
if (!vbasedev->enable_migration || !container->dirty_pages_supported) { if (!vbasedev->enable_migration || !container->dirty_pages_supported) {
@ -885,9 +884,8 @@ add_blocker:
"VFIO device doesn't support migration"); "VFIO device doesn't support migration");
g_free(info); g_free(info);
ret = migrate_add_blocker(vbasedev->migration_blocker, &local_err); ret = migrate_add_blocker(vbasedev->migration_blocker, errp);
if (local_err) { if (ret < 0) {
error_propagate(errp, local_err);
error_free(vbasedev->migration_blocker); error_free(vbasedev->migration_blocker);
vbasedev->migration_blocker = NULL; vbasedev->migration_blocker = NULL;
} }