[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 6/6] net: Don't use error_is_set() to suppress additi
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 6/6] net: Don't use error_is_set() to suppress additional errors |
Date: |
Fri, 25 Apr 2014 16:09:40 +0200 |
From: Markus Armbruster <address@hidden>
Using error_is_set(errp) that way can sweep programming errors under
the carpet when we get called incorrectly with an error set.
qmp_query_rx_filter() breaks its loop when it detects an error. It
needs to set another error when the loop completes normally.
Return right away instead of merely breaking the loop.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
net/net.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/net.c b/net/net.c
index ccb354a..9db4dba 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1045,7 +1045,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name,
const char *name,
if (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) {
if (has_name) {
error_setg(errp, "net client(%s) isn't a NIC", name);
- break;
+ return NULL;
}
continue;
}
@@ -1064,7 +1064,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name,
const char *name,
} else if (has_name) {
error_setg(errp, "net client(%s) doesn't support"
" rx-filter querying", name);
- break;
+ return NULL;
}
if (has_name) {
@@ -1072,7 +1072,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name,
const char *name,
}
}
- if (filter_list == NULL && !error_is_set(errp) && has_name) {
+ if (filter_list == NULL && has_name) {
error_setg(errp, "invalid net client name: %s", name);
}
--
1.9.0
- [Qemu-devel] [PULL 0/6] Net pull request, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 1/6] tap: Avoid extra iterations while closing file fd, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 2/6] pcnet: remove duplicate assignment, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 6/6] net: Don't use error_is_set() to suppress additional errors,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 4/6] net: xilinx_axienet.c: Add phy soft reset bit clearing, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 3/6] net/net.c: Remove unnecessary semicolon, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 5/6] net: Make qmp_query_rx_filter() with name argument more obvious, Stefan Hajnoczi, 2014/04/25
- Re: [Qemu-devel] [PULL 0/6] Net pull request, Peter Maydell, 2014/04/28