1
0
Fork 0

irqbypass: do not start cons/prod when failed connect

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>
5.9.x+fslc
Zhu Lingshan 2020-07-31 14:55:33 +08:00 committed by Michael S. Tsirkin
parent 3597a2fba6
commit a979a6aa00
1 changed files with 10 additions and 6 deletions

View 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;
}