qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] net: Don't use error_is_set() to suppress addit


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH 2/2] net: Don't use error_is_set() to suppress additional errors
Date: Thu, 24 Apr 2014 15:44:18 +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 <address@hidden>
---
 net/net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/net.c b/net/net.c
index 3175809..aaf4a60 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1043,7 +1043,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;
         }
@@ -1062,7 +1062,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) {
@@ -1070,7 +1070,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.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]