qemu-e2k/qga
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
..
installer qga: Installer: Wait for installation to finish 2020-03-24 11:32:19 -05:00
vss-win32 qga-win: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error 2020-03-24 11:32:19 -05:00
Makefile.objs qapi: Generate command registration stuff into separate files 2020-01-14 11:01:58 +01:00
channel-posix.c socket: Add backlog parameter to socket_listen 2019-09-03 23:24:42 +02:00
channel-win32.c qga: Fix a memory leak 2020-03-09 13:36:15 +01:00
channel.h qga: add systemd socket activation support 2017-03-06 00:54:18 -06:00
commands-common.h qga: Extract qmp_guest_file_read() to common commands.c 2020-04-15 09:15:53 -05:00
commands-posix.c qga: Plug unlikely memory leak in guest-set-memory-blocks 2020-07-02 06:25:29 +02:00
commands-win32.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
commands.c qga: Restrict guest-file-read count to 48 MB to avoid crashes 2020-04-15 09:18:48 -05:00
guest-agent-command-state.c qga: use local path for local headers 2018-06-01 19:20:38 +03:00
guest-agent-core.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
main.c qemu-ga: document vsock-listen in the man page 2020-03-24 11:32:19 -05:00
qapi-schema.json qga: Restrict guest-file-read count to 48 MB to avoid crashes 2020-04-15 09:18:48 -05:00
service-win32.c qga: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
service-win32.h qga-win: changing --retry-path option behavior 2018-10-31 09:04:20 -05:00
vss-win32.c qga-win: add support for qmp_guest_fsfreeze_freeze_list 2018-10-30 16:48:49 -05:00
vss-win32.h qga-win: add support for qmp_guest_fsfreeze_freeze_list 2018-10-30 16:48:49 -05:00