]> www.infradead.org Git - qemu-nvme.git/commit
vfio/migration: Add helper function to set state or reset device
authorAvihai Horon <avihaih@nvidia.com>
Sun, 31 Dec 2023 10:48:18 +0000 (12:48 +0200)
committerCédric Le Goater <clg@redhat.com>
Fri, 5 Jan 2024 20:25:20 +0000 (21:25 +0100)
commitc817e5a377a334241eed149e35760aca58bdeb34
treee8cd9327d0a42e914b22e44ea9d2db891f8b9751
parent9f734a117cbf63b03577b46c8cad8ad88ec6dced
vfio/migration: Add helper function to set state or reset device

There are several places where failure in setting the device state leads
to a device reset, which is done by setting ERROR as the recover state.

Add a helper function that sets the device state and resets the device
in case of failure. This will make the code cleaner and remove duplicate
comments.

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/vfio/migration.c