From: Simon Glass Date: Sun, 17 Dec 2023 16:36:19 +0000 (-0700) Subject: fdtgrep: Simplify code to inverting the match X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=490afe74287fef246320c6473f74b2fc2a62c745;p=u-boot.git fdtgrep: Simplify code to inverting the match The code to invert the match in h_include() is a bit convoluted. Simplify it by using disp->invert only once. Signed-off-by: Simon Glass --- diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c index a6cdc32670..b06a1a7a83 100644 --- a/tools/fdtgrep.c +++ b/tools/fdtgrep.c @@ -634,14 +634,8 @@ static int h_include(void *priv, const void *fdt, int offset, int type, inc = 0; } - switch (inc) { - case 1: - inc = !disp->invert; - break; - case 0: - inc = disp->invert; - break; - } + if (inc != -1 && disp->invert) + inc = !inc; debug(" - returning %d\n", inc); return inc;