diff --git a/ubus_api_validator.c b/ubus_api_validator.c
index 6557b4d2678c53e69ea907d32b1e3db6b3a44140..874276d3333b9f80d32411a074080098f807e5d9 100644
--- a/ubus_api_validator.c
+++ b/ubus_api_validator.c
@@ -119,13 +119,11 @@ static int validate_jobj(struct json_object *jobj) {
       }
     }
 
-    // rc == res->rc handles negative testing
-    if (rv_validation || (rc == res->rc)) {
-      ok(true, format);
-    } else {
-      ok(false, format);
-      failed = 1;
-    }
+    if (!rv_validation || rc != res->rc) {
+        ok(false, format);
+        failed = 1;
+    } else
+        ok(true, format);
 
     free(res);
   }