qemu-e2k/backends
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
..
tpm qapi: Use returned bool to check for failure, Coccinelle part 2020-07-10 15:18:08 +02:00
cryptodev-builtin.c cryptodev: Fix cryptodev_builtin_cleanup() error API violation 2020-04-29 08:01:52 +02:00
cryptodev-vhost-user.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
cryptodev-vhost.c
cryptodev.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
dbus-vmstate.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
hostmem-file.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
hostmem-memfd.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
hostmem-ram.c machine: alias -mem-path and -mem-prealloc into memory-foo backend 2020-02-19 16:49:53 +00:00
hostmem.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
Kconfig tpm: Move backend code under the 'backends/' directory 2020-06-19 07:25:55 -04:00
Makefile.objs backends: Add TPM files into their own directory 2020-06-19 07:24:42 -04:00
rng-builtin.c
rng-egd.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
rng-random.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
rng.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
trace-events Add dbus-vmstate object 2020-01-06 18:41:32 +04:00
vhost-user.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00