diff mbox series

[06/10] fdtgrep: Simplify code to inverting the match

Message ID 20231217163627.2339802-7-sjg@chromium.org
State Accepted
Commit 490afe74287fef246320c6473f74b2fc2a62c745
Delegated to: Simon Glass
Headers show
Series Make bootph tags transistive to parents | expand

Commit Message

Simon Glass Dec. 17, 2023, 4:36 p.m. UTC
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>
---

 tools/fdtgrep.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Simon Glass Jan. 1, 2024, 4:49 p.m. UTC | #1
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>
---

 tools/fdtgrep.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
index a6cdc326709d..b06a1a7a8384 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;