diff options
author | Max Reitz <mreitz@redhat.com> | 2015-10-19 17:53:29 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2015-10-23 18:18:23 +0200 |
commit | 5433c24f0f9306c82ad9bcc2b2b586e5f0ed8fa5 (patch) | |
tree | 8b2eb29767ef12bf28d528050a0463b3e9458f5b /block/qapi.c | |
parent | 0c3c36d651922ebe9244e68e6d9ed14cdfcac9fd (diff) |
block: Prepare for NULL BDS
blk_bs() will not necessarily return a non-NULL value any more (unless
blk_is_available() is true or it can be assumed to otherwise, e.g.
because it is called immediately after a successful blk_new_with_bs() or
blk_new_open()).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qapi.c')
-rw-r--r-- | block/qapi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/qapi.c b/block/qapi.c index 3b46f97b8d..ec0f5139e2 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -306,12 +306,12 @@ static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, info->io_status = blk_iostatus(blk); } - if (!QLIST_EMPTY(&bs->dirty_bitmaps)) { + if (bs && !QLIST_EMPTY(&bs->dirty_bitmaps)) { info->has_dirty_bitmaps = true; info->dirty_bitmaps = bdrv_query_dirty_bitmaps(bs); } - if (bs->drv) { + if (bs && bs->drv) { info->has_inserted = true; info->inserted = bdrv_block_device_info(bs, errp); if (info->inserted == NULL) { |