[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 3/4] failover: really display a warning when the primary d

From: Jens Freimann
Subject: Re: [PATCH v3 3/4] failover: really display a warning when the primary device is not found
Date: Fri, 12 Feb 2021 15:40:24 +0100

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 <lvivier@redhat.com>
hw/net/virtio-net.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

Thank you Laurent!

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]