On Fri, Feb 12, 2021 at 02:52:49PM +0100, Laurent Vivier wrote:
In failover_add_primary(), we search the id of the failover device by
scanning the list of the devices in the opts list to find a device with
a failover_pair_id equals to the id of the virtio-net device.

If the failover_pair_id is not found, QEMU ignores the primary
device silently (which also means it will not be hidden and
it will be enabled directly at boot).

After that, we search the id in the opts list to do a qdev_device_add()
with it. The device will be always found as otherwise we had exited
before, and thus the warning is never displayed.

Fix that by moving the error report to the first exit condition.
Also add a g_assert() to be sure the compiler will not complain
about a possibly NULL pointer.

Signed-off-by: Laurent Vivier <lviv...@redhat.com>
---
hw/net/virtio-net.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)


Thank you Laurent!

Reviewed-by: Jens Freimann <jfreim...@redhat.com>

regards,
Jens


Reply via email to