提交 779020cb 编写于 作者: K Kevin Wolf

block: Allow bdrv_unref_child(bs, NULL)

bdrv_unref() can be called with a NULL argument and doesn't do anything
then. Make bdrv_unref_child() consistent with it.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NJeff Cody <jcody@redhat.com>
上级 8e419aef
......@@ -1104,12 +1104,17 @@ static void bdrv_detach_child(BdrvChild *child)
void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
{
BlockDriverState *child_bs = child->bs;
BlockDriverState *child_bs;
if (child == NULL) {
return;
}
if (child->bs->inherits_from == parent) {
child->bs->inherits_from = NULL;
}
child_bs = child->bs;
bdrv_detach_child(child);
bdrv_unref(child_bs);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册