From 8b2ff5291f9e39fb1c0c6c0c4321daac60aab4db Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 20 Dec 2016 22:21:17 +0100 Subject: block: Add Error argument to bdrv_attach_child() It will have to return an error soon, so prepare the callers for it. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Acked-by: Fam Zheng --- block/quorum.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'block/quorum.c') diff --git a/block/quorum.c b/block/quorum.c index 86e2072dce..bdbcec6e00 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -1032,10 +1032,17 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, /* We can safely add the child now */ bdrv_ref(child_bs); - child = bdrv_attach_child(bs, child_bs, indexstr, &child_format); + + child = bdrv_attach_child(bs, child_bs, indexstr, &child_format, errp); + if (child == NULL) { + s->next_child_index--; + bdrv_unref(child_bs); + goto out; + } s->children = g_renew(BdrvChild *, s->children, s->num_children + 1); s->children[s->num_children++] = child; +out: bdrv_drained_end(bs); } -- cgit v1.2.3