[PATCH 1/3] checks: Restructure check_msg to decrease indentation

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



The entire check_msg function is under the if condition except for
va_start/va_end. Move these and invert the if condition saving a level
of indentation.

Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
---
 checks.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/checks.c b/checks.c
index ed84e03e6d2f..4d8dffd36b6e 100644
--- a/checks.c
+++ b/checks.c
@@ -78,23 +78,23 @@ static inline void  PRINTF(5, 6) check_msg(struct check *c, struct dt_info *dti,
 					   const char *fmt, ...)
 {
 	va_list ap;
-	va_start(ap, fmt);
 
-	if ((c->warn && (quiet < 1))
-	    || (c->error && (quiet < 2))) {
-		fprintf(stderr, "%s: %s (%s): ",
-			strcmp(dti->outname, "-") ? dti->outname : "<stdout>",
-			(c->error) ? "ERROR" : "Warning", c->name);
-		if (node) {
-			fprintf(stderr, "%s", node->fullpath);
-			if (prop)
-				fprintf(stderr, ":%s", prop->name);
-			fputs(": ", stderr);
-		}
-		vfprintf(stderr, fmt, ap);
-		fprintf(stderr, "\n");
+	if (!(c->warn && (quiet < 1)) && !(c->error && (quiet < 2)))
+		return;
+
+	fprintf(stderr, "%s: %s (%s): ",
+		strcmp(dti->outname, "-") ? dti->outname : "<stdout>",
+		(c->error) ? "ERROR" : "Warning", c->name);
+	if (node) {
+		fprintf(stderr, "%s", node->fullpath);
+		if (prop)
+			fprintf(stderr, ":%s", prop->name);
+		fputs(": ", stderr);
 	}
+	va_start(ap, fmt);
+	vfprintf(stderr, fmt, ap);
 	va_end(ap);
+	fprintf(stderr, "\n");
 }
 
 #define FAIL(c, dti, node, ...)						\
-- 
2.19.1




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux