Skip to contentSkip to conversation

libfdt: Drop including string.h from libfdt_internal.h

PATCH In review Rob Herring (Arm) 3 participants 3 messages Aug 11, 2025 – Aug 13, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libfdt: Drop including string.h from libfdt_internal.h

Commit 0f69cedc08fc ("libfdt_internal: fdt_find_string_len_()") added a string.h include to libfdt_internal.h which introduces a libc dependency which cannot be overridden. Environments without libc (e.g. Linux kernel) use a custom libfdt_env.h. string.h is already indirectly included in libfdt_env.h, so it can be dropped from libfdt_internal.h.

Fixes 0f69cedc08fc ("libfdt_internal: fdt_find_string_len_()")
---
 libfdt/libfdt_internal.h | 1 -
 1 file changed, 1 deletion(-)
libfdt/libfdt_internal.h +0 -1
index 773bba87bc6e..b60b5456f596 100644
@@ -6,7 +6,6 @@
  * Copyright (C) 2006 David Gibson, IBM Corporation.
  */
 #include <fdt.h>
-#include <string.h>
 
 #define FDT_ALIGN(x, a)		(((x) + (a) - 1) & ~((a) - 1))
 #define FDT_TAGALIGN(x)		(FDT_ALIGN((x), FDT_TAGSIZE))
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rob Herring (Arm)

Commit 0f69cedc08fc ("libfdt_internal: fdt_find_string_len_()") added a string.h include to libfdt_internal.h which introduces a libc dependency which cannot be overridden. Environments without libc (e.g. Linux kernel) use a custom libfdt_env.h. string.h is already indirectly included in libfdt_env.h, so it can be dropped from libfdt_internal.h.

Quoted 5 lines
Fixes 0f69cedc08fc ("libfdt_internal: fdt_find_string_len_()")
---
 libfdt/libfdt_internal.h | 1 -
 1 file changed, 1 deletion(-)
Quoted 17 lines
libfdt/libfdt_internal.h +0 -2
index 773bba87bc6e..b60b5456f596 100644
@@ -6,7 +6,6 @@
  * Copyright (C) 2006 David Gibson, IBM Corporation.
  */
 #include <fdt.h>
-#include <string.h>
 
 #define FDT_ALIGN(x, a)                (((x) + (a) - 1) & ~((a) - 1))
 #define FDT_TAGALIGN(x)                (FDT_ALIGN((x), FDT_TAGSIZE))
--

2.47.2

#2 lore raw
In reply to Rob Herring (Arm)
Quoted 8 lines · Rob Herring (Arm)

Commit 0f69cedc08fc ("libfdt_internal: fdt_find_string_len_()") added a string.h include to libfdt_internal.h which introduces a libc dependency which cannot be overridden. Environments without libc (e.g. Linux kernel) use a custom libfdt_env.h. string.h is already indirectly included in libfdt_env.h, so it can be dropped from libfdt_internal.h.

Fixes 0f69cedc08fc ("libfdt_internal: fdt_find_string_len_()")

Ouch, should have spotted that on review, sorry.

Fix merged.

Quoted 16 lines
---
 libfdt/libfdt_internal.h | 1 -
 1 file changed, 1 deletion(-)
libfdt/libfdt_internal.h +0 -1
index 773bba87bc6e..b60b5456f596 100644
@@ -6,7 +6,6 @@
  * Copyright (C) 2006 David Gibson, IBM Corporation.
  */
 #include <fdt.h>
-#include <string.h>
 
 #define FDT_ALIGN(x, a)		(((x) + (a) - 1) & ~((a) - 1))
 #define FDT_TAGALIGN(x)		(FDT_ALIGN((x), FDT_TAGSIZE))
Signature · 4 lines
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson