Merge tag 's390-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[linux-2.6-microblaze.git] / virt / lib / irqbypass.c
index 28fda42..c9bb395 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;
 }