Skip to content

Commit

Permalink
irqbypass: do not start cons/prod when failed connect
Browse files Browse the repository at this point in the history
If failed to connect, there is no need to start consumer nor
producer.

Signed-off-by: Zhu Lingshan <[email protected]>
Suggested-by: Jason Wang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
ls-zhu authored and mstsirkin committed Aug 5, 2020
1 parent 3597a2f commit a979a6a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions virt/lib/irqbypass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a979a6a

Please sign in to comment.