]> git.proxmox.com Git - mirror_qemu.git/commit - block/file-win32.c
error: Eliminate error_propagate() with Coccinelle, part 2
authorMarkus Armbruster <armbru@redhat.com>
Tue, 7 Jul 2020 16:06:03 +0000 (18:06 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 10 Jul 2020 13:18:08 +0000 (15:18 +0200)
commitaf175e85f92c870386ad74f466e29537b79611d3
treea2b62ef63640b200b969ff3eb7c0a4c1fd0be013
parent668f62ec621e4e2919fb7d4caa5d805764c5852d
error: Eliminate error_propagate() with Coccinelle, part 2

When all we do with an Error we receive into a local variable is
propagating to somewhere else, we can just as well receive it there
right away.  The previous commit did that with a Coccinelle script I
consider fairly trustworthy.  This commit uses the same script with
the matching of return taken out, i.e. we convert

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

to

    if (!foo(..., errp)) {
        ...
        ...
    }

This is unsound: @err could still be read between afterwards.  I don't
know how to express "no read of @err without an intervening write" in
Coccinelle.  Instead, I manually double-checked for uses of @err.

Suboptimal line breaks tweaked manually.  qdev_realize() simplified
further to placate scripts/checkpatch.pl.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-36-armbru@redhat.com>
23 files changed:
block.c
block/blkdebug.c
block/blklogwrites.c
block/blkverify.c
block/crypto.c
block/file-posix.c
block/file-win32.c
block/gluster.c
block/iscsi.c
block/nbd.c
block/qcow2.c
block/raw-format.c
block/sheepdog.c
block/ssh.c
block/throttle.c
block/vmdk.c
block/vpc.c
block/vvfat.c
blockdev.c
hw/intc/xics.c
hw/vfio/pci.c
net/tap.c
qom/object.c