aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-12-17 09:36:19 -0700
committerSimon Glass <sjg@chromium.org>2023-12-31 07:21:02 -0700
commit490afe74287fef246320c6473f74b2fc2a62c745 (patch)
tree91d530369b09a10316c08b85fc88575a1cccabc3 /tools
parentb1823ed1715910b1af68815a27c33c2c992e685c (diff)
downloadu-boot-490afe74287fef246320c6473f74b2fc2a62c745.zip
u-boot-490afe74287fef246320c6473f74b2fc2a62c745.tar.gz
u-boot-490afe74287fef246320c6473f74b2fc2a62c745.tar.bz2
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 <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/fdtgrep.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
index a6cdc32..b06a1a7 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;