aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block.c b/block.c
index 281ce7bec3..52c1f280dc 100644
--- a/block.c
+++ b/block.c
@@ -1360,8 +1360,9 @@ static int bdrv_check_perm(BlockDriverState *bs, uint64_t cumulative_perms,
cumulative_shared_perms, errp);
}
- /* Drivers may not have .bdrv_child_perm() */
+ /* Drivers that never have children can omit .bdrv_child_perm() */
if (!drv->bdrv_child_perm) {
+ assert(QLIST_EMPTY(&bs->children));
return 0;
}
@@ -1420,8 +1421,9 @@ static void bdrv_set_perm(BlockDriverState *bs, uint64_t cumulative_perms,
drv->bdrv_set_perm(bs, cumulative_perms, cumulative_shared_perms);
}
- /* Drivers may not have .bdrv_child_perm() */
+ /* Drivers that never have children can omit .bdrv_child_perm() */
if (!drv->bdrv_child_perm) {
+ assert(QLIST_EMPTY(&bs->children));
return;
}