aboutsummaryrefslogtreecommitdiff
path: root/block/quorum.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-02-02 15:49:45 +0300
committerEric Blake <eblake@redhat.com>2021-03-08 15:07:09 -0600
commitbc520249595845d387aa5b5e4eeeade673931a98 (patch)
tree08a767dbc1d9af92903e043028eb0216c25d89cf /block/quorum.c
parentf174cd3350c5e97db000e7383be974c66046b8f5 (diff)
downloadqemu-bc520249595845d387aa5b5e4eeeade673931a98.zip
qemu-bc520249595845d387aa5b5e4eeeade673931a98.tar.gz
qemu-bc520249595845d387aa5b5e4eeeade673931a98.tar.bz2
block: check return value of bdrv_open_child and drop error propagation
This patch is generated by cocci script: @@ symbol bdrv_open_child, errp, local_err; expression file; @@ file = bdrv_open_child(..., - &local_err + errp ); - if (local_err) + if (!file) { ... - error_propagate(errp, local_err); ... } with command spatch --sp-file x.cocci --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 --use-gitgrep block Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20210202124956.63146-4-vsementsov@virtuozzo.com> [eblake: fix qcow2_do_open() to use ERRP_GUARD, necessary as the only caller to pass allow_none=true] Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/quorum.c')
-rw-r--r--block/quorum.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/quorum.c b/block/quorum.c
index 0bd7545..cfc1436 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -929,7 +929,6 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVQuorumState *s = bs->opaque;
- Error *local_err = NULL;
QemuOpts *opts = NULL;
const char *pattern_str;
bool *opened;
@@ -1007,9 +1006,8 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
s->children[i] = bdrv_open_child(NULL, options, indexstr, bs,
&child_of_bds, BDRV_CHILD_DATA, false,
- &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
+ errp);
+ if (!s->children[i]) {
ret = -EINVAL;
goto close_exit;
}