[PATCH v3 02/15] libfdt: overlay: Drop redundant *sep != ':' checks after memchr()
From: Douglas Anderson
Date: Sun Nov 01 2026 - 17:04:22 EST
In `overlay_fixup_phandle()`, `sep` is obtained via `memchr(..., ':',
...)`. When `sep` is non-NULL, `*sep` is guaranteed to be `':'`, so the
`|| *sep != ':'` checks are redundant. Drop them.
Assisted-by: Gemini:gemini-pro-prerelease
Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
---
Changes in v3:
- Split the removal of redundant *sep != ':' checks out of "libfdt:
overlay: Prepare fixup and fragment path helpers for reuse" into a
standalone patch
libfdt/fdt_overlay.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
index c6dc4774cff3..8d96428af04f 100644
--- a/libfdt/fdt_overlay.c
+++ b/libfdt/fdt_overlay.c
@@ -432,7 +432,7 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off,
path = fixup_str;
sep = memchr(fixup_str, ':', fixup_len);
- if (!sep || *sep != ':')
+ if (!sep)
return -FDT_ERR_BADOVERLAY;
path_len = sep - path;
@@ -442,7 +442,7 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off,
fixup_len -= path_len + 1;
name = sep + 1;
sep = memchr(name, ':', fixup_len);
- if (!sep || *sep != ':')
+ if (!sep)
return -FDT_ERR_BADOVERLAY;
name_len = sep - name;
--
2.56.0.317.g454f8302e1-goog