]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
irqbypass: do not start cons/prod when failed connect
authorZhu Lingshan <lingshan.zhu@intel.com>
Fri, 31 Jul 2020 06:55:33 +0000 (14:55 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 5 Aug 2020 15:08:42 +0000 (11:08 -0400)
If failed to connect, there is no need to start consumer nor
producer.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Suggested-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20200731065533.4144-7-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virt/lib/irqbypass.c

index 28fda42e471bbdabfcf3a4ebad772cf9317e320f..c9bb3957f58a72eefb3865f07c669be73deb4faa 100644 (file)
@@ -40,17 +40,21 @@ static int __connect(struct irq_bypass_producer *prod,
        if (prod->add_consumer)
                ret = prod->add_consumer(prod, cons);
 
-       if (!ret) {
-               ret = cons->add_producer(cons, prod);
-               if (ret && prod->del_consumer)
-                       prod->del_consumer(prod, cons);
-       }
+       if (ret)
+               goto err_add_consumer;
+
+       ret = cons->add_producer(cons, prod);
+       if (ret)
+               goto err_add_producer;
 
        if (cons->start)
                cons->start(cons);
        if (prod->start)
                prod->start(prod);
-
+err_add_producer:
+       if (prod->del_consumer)
+               prod->del_consumer(prod, cons);
+err_add_consumer:
        return ret;
 }