Commit a979a6aa authored by Zhu Lingshan's avatar Zhu Lingshan Committed by Michael S. Tsirkin

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: default avatarZhu Lingshan <lingshan.zhu@intel.com>
Suggested-by: default avatarJason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20200731065533.4144-7-lingshan.zhu@intel.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 3597a2fb
...@@ -40,17 +40,21 @@ static int __connect(struct irq_bypass_producer *prod, ...@@ -40,17 +40,21 @@ static int __connect(struct irq_bypass_producer *prod,
if (prod->add_consumer) if (prod->add_consumer)
ret = prod->add_consumer(prod, cons); ret = prod->add_consumer(prod, cons);
if (!ret) { if (ret)
ret = cons->add_producer(cons, prod); goto err_add_consumer;
if (ret && prod->del_consumer)
prod->del_consumer(prod, cons); ret = cons->add_producer(cons, prod);
} if (ret)
goto err_add_producer;
if (cons->start) if (cons->start)
cons->start(cons); cons->start(cons);
if (prod->start) if (prod->start)
prod->start(prod); prod->start(prod);
err_add_producer:
if (prod->del_consumer)
prod->del_consumer(prod, cons);
err_add_consumer:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment