From 5b3639371c3e220b41cd2eae8c34c49ad38ef527 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 17 May 2016 16:41:31 +0200 Subject: block: Make bdrv_open() return a BDS There are no callers to bdrv_open() or bdrv_open_inherit() left that pass a pointer to a non-NULL BDS pointer as the first argument of these functions, so we can finally drop that parameter and just make them return the new BDS. Generally, the following pattern is applied: bs = NULL; ret = bdrv_open(&bs, ..., &local_err); if (ret < 0) { error_propagate(errp, local_err); ... } by bs = bdrv_open(..., errp); if (!bs) { ret = -EINVAL; ... } Of course, there are only a few instances where the pattern is really pure. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/block-backend.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'block/block-backend.c') diff --git a/block/block-backend.c b/block/block-backend.c index b96323f658..bc1f071354 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -152,7 +152,6 @@ BlockBackend *blk_new_open(const char *filename, const char *reference, { BlockBackend *blk; BlockDriverState *bs; - int ret; blk = blk_new(errp); if (!blk) { @@ -160,9 +159,8 @@ BlockBackend *blk_new_open(const char *filename, const char *reference, return NULL; } - bs = NULL; - ret = bdrv_open(&bs, filename, reference, options, flags, errp); - if (ret < 0) { + bs = bdrv_open(filename, reference, options, flags, errp); + if (!bs) { blk_unref(blk); return NULL; } -- cgit v1.2.3