]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
net: Don't use error_is_set() to suppress additional errors
authorMarkus Armbruster <armbru@redhat.com>
Thu, 24 Apr 2014 13:44:18 +0000 (15:44 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 25 Apr 2014 13:58:07 +0000 (15:58 +0200)
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 <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
net/net.c

index ccb354aee8edac7cd3794f6cd8365a2f692c357a..9db4dba769ae487a0f0bccc77b85e97a3e9dcd00 100644 (file)
--- 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);
     }