[2/4] net/virtio: return early when failover primary alread added
diff mbox series

Message ID 20191114141613.15804-2-jfreimann@redhat.com
State New
Headers show
Series
  • [1/4] net/virtio: fix dev_unplug_pending
Related show

Commit Message

Jens Freimann Nov. 14, 2019, 2:16 p.m. UTC
Bail out when primary device was already added before.
This avoids printing a wrong warning message during reboot.

Fixes: 9711cd0dfc3f ("net/virtio: add failover support")
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
---
 hw/net/virtio-net.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael S. Tsirkin Nov. 20, 2019, 10:40 a.m. UTC | #1
On Thu, Nov 14, 2019 at 03:16:11PM +0100, Jens Freimann wrote:
> Bail out when primary device was already added before.
> This avoids printing a wrong warning message during reboot.
> 
> Fixes: 9711cd0dfc3f ("net/virtio: add failover support")
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/net/virtio-net.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 946039c0dc..ac4d19109e 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -759,6 +759,10 @@ static void failover_add_primary(VirtIONet *n, Error **errp)
>  {
>      Error *err = NULL;
>  
> +    if (n->primary_dev) {
> +        return;
> +    }
> +
>      n->primary_device_opts = qemu_opts_find(qemu_find_opts("device"),
>              n->primary_device_id);
>      if (n->primary_device_opts) {
> -- 
> 2.21.0

Patch
diff mbox series

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 946039c0dc..ac4d19109e 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -759,6 +759,10 @@  static void failover_add_primary(VirtIONet *n, Error **errp)
 {
     Error *err = NULL;
 
+    if (n->primary_dev) {
+        return;
+    }
+
     n->primary_device_opts = qemu_opts_find(qemu_find_opts("device"),
             n->primary_device_id);
     if (n->primary_device_opts) {