diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-01-30 15:07:28 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-02-17 11:57:23 -0500 |
commit | 84d18f065fb041a1c0d78d20320d740ae0673c8a (patch) | |
tree | c43dbfdadc21d4fff0f173f9413396cd314927f9 /block.c | |
parent | ff9ec34de8f6a37bd29ac72c0c4c94bd5d43d7b0 (diff) |
Use error_is_set() only when necessary
error_is_set(&var) is the same as var != NULL, but it takes
whole-program analysis to figure that out. Unnecessarily hard for
optimizers, static checkers, and human readers. Dumb it down to
obvious.
Gets rid of several dozen Coverity false positives.
Note that the obvious form is already used in many places.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -421,7 +421,7 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque) assert(cco->drv); ret = cco->drv->bdrv_create(cco->filename, cco->options, &local_err); - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(&cco->err, local_err); } cco->ret = ret; @@ -460,7 +460,7 @@ int bdrv_create(BlockDriver *drv, const char* filename, ret = cco.ret; if (ret < 0) { - if (error_is_set(&cco.err)) { + if (cco.err) { error_propagate(errp, cco.err); } else { error_setg_errno(errp, -ret, "Could not create image"); @@ -486,7 +486,7 @@ int bdrv_create_file(const char* filename, QEMUOptionParameter *options, } ret = bdrv_create(drv, filename, options, &local_err); - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); } return ret; @@ -909,7 +909,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, } if (ret < 0) { - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); } else if (bs->filename[0]) { error_setg_errno(errp, -ret, "Could not open '%s'", bs->filename); @@ -1031,7 +1031,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, /* Parse the filename and open it */ if (drv->bdrv_parse_filename && filename) { drv->bdrv_parse_filename(filename, options, &local_err); - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; @@ -1400,7 +1400,7 @@ fail: QDECREF(bs->options); QDECREF(options); bs->options = NULL; - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); } return ret; @@ -1408,7 +1408,7 @@ fail: close_and_fail: bdrv_close(bs); QDECREF(options); - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); } return ret; @@ -5338,7 +5338,7 @@ out: free_option_parameters(create_options); free_option_parameters(param); - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); } } |