block: Remove unnecessary cases of error_propagate()
PATCH 1/1 block: Remove unnecessary cases of error_propagate()
There are several cases of local Error variables that are never used for checking actual errors:
ret = some_call(params, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto fail;
}In these cases there's no need for local_err or error_propagate(), and we can use errp directly instead.
Signed-off-by Alberto Garcia <[email protected]>
--- block.c | 4 +--- blockdev.c | 53 +++++++++++++++-------------------------------------- 2 files changed, 16 insertions(+), 41 deletions(-)
block.c +1 -3
@@ -2088,7 +2088,6 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **er {int ret =-1 ;BlockReopenQueueEntry *bs_entry, *next; -Error *local_err =NULL ;assert (bs_queue !=NULL );
@@ -2097,8 +2096,7 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **eraio_context_acquire (ctx); QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) { -if (bdrv_reopen_prepare (&bs_entry->state, bs_queue, &local_err)) { -error_propagate (errp, local_err); +if (bdrv_reopen_prepare (&bs_entry->state, bs_queue, errp)) { goto cleanup; } bs_entry->prepared = true;
blockdev.c +15 -38
141 lines not on this page · raw message
Signature · 1 line
2.11.0
Quoted 5 lines · Alberto Garcia
if (rc && rc != -ENOSYS) {blockdev.c +0
-2-error_propagate (errp, local_err);return ; } -error_free (local_err);
[...]
Quoted 5 lines
blockdev.c +0
-5-if (rc && rc != -ENOSYS && rc != -EINPROGRESS ) { -error_propagate (errp, local_err); -return ; - } -error_free (local_err);
[...]
blockdev.c void qmp_blockdev_change_medium(bool has_device, const char *device, · line 2573
Quoted 10 lines
rc = do_open_tray(has_device ? device : NULL,
has_id? id : NULL,blockdev.c +1
-4- false, &err); + false, errp);if (rc && rc != -ENOSYS ) { -error_propagate (errp, err); goto fail; } -error_free (err); - err =NULL ;
I just noticed that these three changes are wrong, sorry for the noise!
Berto