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>
Showing
- block.c 2 additions, 4 deletionsblock.c
- block/blkdebug.c 2 additions, 5 deletionsblock/blkdebug.c
- block/blklogwrites.c 1 addition, 2 deletionsblock/blklogwrites.c
- block/blkverify.c 1 addition, 2 deletionsblock/blkverify.c
- block/crypto.c 1 addition, 3 deletionsblock/crypto.c
- block/file-posix.c 2 additions, 4 deletionsblock/file-posix.c
- block/file-win32.c 2 additions, 4 deletionsblock/file-win32.c
- block/gluster.c 1 addition, 3 deletionsblock/gluster.c
- block/iscsi.c 1 addition, 2 deletionsblock/iscsi.c
- block/nbd.c 2 additions, 6 deletionsblock/nbd.c
- block/qcow2.c 4 additions, 9 deletionsblock/qcow2.c
- block/raw-format.c 1 addition, 3 deletionsblock/raw-format.c
- block/sheepdog.c 2 additions, 6 deletionsblock/sheepdog.c
- block/ssh.c 1 addition, 2 deletionsblock/ssh.c
- block/throttle.c 1 addition, 3 deletionsblock/throttle.c
- block/vmdk.c 1 addition, 3 deletionsblock/vmdk.c
- block/vpc.c 1 addition, 2 deletionsblock/vpc.c
- block/vvfat.c 1 addition, 2 deletionsblock/vvfat.c
- blockdev.c 1 addition, 2 deletionsblockdev.c
- hw/intc/xics.c 1 addition, 3 deletionshw/intc/xics.c
Loading
Please register or sign in to comment