summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarkus Armbruster2020-07-07 18:06:03 +0200
committerMarkus Armbruster2020-07-10 15:18:08 +0200
commitaf175e85f92c870386ad74f466e29537b79611d3 (patch)
treea2b62ef63640b200b969ff3eb7c0a4c1fd0be013 /net
parenterror: Eliminate error_propagate() with Coccinelle, part 1 (diff)
downloadqemu-af175e85f92c870386ad74f466e29537b79611d3.tar.gz
qemu-af175e85f92c870386ad74f466e29537b79611d3.tar.xz
qemu-af175e85f92c870386ad74f466e29537b79611d3.zip
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>
Diffstat (limited to 'net')
-rw-r--r--net/tap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/tap.c b/net/tap.c
index 2d8d83a30b..f9dcc2ef51 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -836,9 +836,8 @@ int net_init_tap(const Netdev *netdev, const char *name,
}
for (i = 0; i < nfds; i++) {
- fd = monitor_fd_param(cur_mon, fds[i], &err);
+ fd = monitor_fd_param(cur_mon, fds[i], errp);
if (fd == -1) {
- error_propagate(errp, err);
ret = -1;
goto free_fail;
}