checks: Restructure check_msg to decrease indentation

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@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Rob Herring 2018-11-21 15:53:57 -06:00 committed by David Gibson
parent 5667e7ef9a
commit 86a288a736

View file

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