qemu-e2k/block
Markus Armbruster dcfe480544 error: Avoid unnecessary error_propagate() after error_setg()
Replace

    error_setg(&err, ...);
    error_propagate(errp, err);

by

    error_setg(errp, ...);

Related pattern:

    if (...) {
        error_setg(&err, ...);
        goto out;
    }
    ...
 out:
    error_propagate(errp, err);
    return;

When all paths to label out are that way, replace by

    if (...) {
        error_setg(errp, ...);
        return;
    }

and delete the label along with the error_propagate().

When we have at most one other path that actually needs to propagate,
and maybe one at the end that where propagation is unnecessary, e.g.

    foo(..., &err);
    if (err) {
        goto out;
    }
    ...
    bar(..., &err);
 out:
    error_propagate(errp, err);
    return;

move the error_propagate() to where it's needed, like

    if (...) {
        foo(..., &err);
        error_propagate(errp, err);
        return;
    }
    ...
    bar(..., errp);
    return;

and transform the error_setg() as above.

In some places, the transformation results in obviously unnecessary
error_propagate().  The next few commits will eliminate them.

Bonus: the elimination of gotos will make later patches in this series
easier to review.

Candidates for conversion tracked down with this Coccinelle script:

    @@
    identifier err, errp;
    expression list args;
    @@
    -    error_setg(&err, args);
    +    error_setg(errp, args);
         ... when != err
         error_propagate(errp, err);

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-34-armbru@redhat.com>
2020-07-10 15:18:08 +02:00
..
monitor blockdev: Split off basic bitmap operations for qemu-img 2020-05-19 10:32:14 -05:00
accounting.c
aio_task.c
amend.c block/core: add generic infrastructure for x-blockdev-amend qmp command 2020-07-06 08:49:28 +02:00
backup-top.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
backup-top.h
backup.c backup: Make sure that source and target size match 2020-05-08 13:26:35 +02:00
blkdebug.c qapi: Use returned bool to check for failure, Coccinelle part 2020-07-10 15:18:08 +02:00
blklogwrites.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
blkreplay.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
blkverify.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
block-backend.c block: Pass BdrvChildRole in remaining cases 2020-05-18 19:05:25 +02:00
block-copy.c block/block-copy: block_copy_dirty_clusters: fix failure check 2020-07-06 08:33:06 +02:00
bochs.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
cloop.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
commit.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
copy-on-read.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
create.c
crypto.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
crypto.h block/crypto: implement the encryption key management 2020-07-06 08:49:28 +02:00
curl.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
dirty-bitmap.c block/dirty-bitmap: add bdrv_has_named_bitmaps helper 2020-05-28 13:15:22 -05:00
dmg-bz2.c
dmg-lzfse.c
dmg.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
dmg.h
file-posix.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
file-win32.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
filter-compress.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
gluster.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
io_uring.c io_uring: use io_uring_cq_ready() to check for ready cqes 2020-06-05 09:54:48 +01:00
io.c block: drop unallocated_blocks_are_zero 2020-07-06 10:34:14 +02:00
iscsi-opts.c
iscsi.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
linux-aio.c
Makefile.objs block/core: add generic infrastructure for x-blockdev-amend qmp command 2020-07-06 08:49:28 +02:00
mirror.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
nbd.c qapi: Use returned bool to check for failure, Coccinelle part 2020-07-10 15:18:08 +02:00
nfs.c block: Drop unused .bdrv_has_zero_init_truncate 2020-05-08 13:26:35 +02:00
null.c
nvme.c block/nvme: support nested aio_poll() 2020-06-23 15:46:08 +01:00
parallels.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
parallels.h
qapi-sysemu.c
qapi.c
qcow2-bitmap.c qcow2: Tweak comments on qcow2_get_persistent_dirty_bitmap_size 2020-06-17 14:53:39 +02:00
qcow2-cache.c
qcow2-cluster.c
qcow2-refcount.c
qcow2-snapshot.c
qcow2-threads.c qcow2: add zstd cluster compression 2020-05-13 14:20:31 +02:00
qcow2.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
qcow2.h qcow2: Expose bitmaps' size during measure 2020-05-28 13:16:16 -05:00
qcow.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
qed-check.c
qed-cluster.c
qed-l2-cache.c
qed-table.c
qed.c qed: Simplify backing reads 2020-07-06 10:34:14 +02:00
qed.h qed: Simplify backing reads 2020-07-06 10:34:14 +02:00
quorum.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
raw-format.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
rbd.c block: Drop unused .bdrv_has_zero_init_truncate 2020-05-08 13:26:35 +02:00
replication.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
sheepdog.c qapi: Use returned bool to check for failure, Coccinelle part 2020-07-10 15:18:08 +02:00
snapshot.c
ssh.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
stream.c
throttle-groups.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
throttle.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
trace-events block/nvme: support nested aio_poll() 2020-06-23 15:46:08 +01:00
vdi.c block/vdi: return ZERO block-status when appropriate 2020-07-06 08:49:28 +02:00
vhdx-endian.c
vhdx-log.c
vhdx.c block/vhdx: drop unallocated_blocks_are_zero 2020-07-06 10:34:14 +02:00
vhdx.h
vmdk.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
vpc.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
vvfat.c qemu-option: Use returned bool to check for failure 2020-07-10 15:17:35 +02:00
vxhs.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
win32-aio.c
write-threshold.c