libfdt: Revert accidental ABI breakage

Commit bdca8612 introduced the new fdt_setprop_namelen() and
fdt_setprop_placeholder_namelen() functions, making the existing
fdt_setprop() and fdt_setprop_placeholder() trivial inline wrappers around
them.  I failed to realise that replacing the existing functions with
(static) inlines breaks the library ABI.

Theoretically it's possible to have the functions available as both an
inline and a "real" symbol.  However, because they do need to call strlen()
before the lower level fdt function, these wrappers aren't quite as
trivial as they appear (inlining may not be zero cost).  So, instead revert
and keep the old functions as true functions.

Reported-by: David Runge <dave@sleepmap.de>
Fixes: bdca8612 ("libfdt: Add fdt_setprop_namelen()")
Link: https://github.com/dgibson/dtc/issues/184
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2026-05-28 11:20:07 +10:00
parent b1337df195
commit 040c1f7e29
2 changed files with 18 additions and 13 deletions

View file

@ -292,6 +292,13 @@ int fdt_setprop_placeholder_namelen(void *fdt, int nodeoffset, const char *name,
return 0;
}
int fdt_setprop_placeholder(void *fdt, int nodeoffset,
const char *name, int len, void **prop_data)
{
return fdt_setprop_placeholder_namelen(fdt, nodeoffset, name,
strlen(name), len, prop_data);
}
int fdt_setprop_namelen(void *fdt, int nodeoffset, const char *name,
int namelen, const void *val, int len)
{
@ -308,6 +315,13 @@ int fdt_setprop_namelen(void *fdt, int nodeoffset, const char *name,
return 0;
}
int fdt_setprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len)
{
return fdt_setprop_namelen(fdt, nodeoffset, name, strlen(name), val,
len);
}
int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len)
{

View file

@ -1935,12 +1935,8 @@ int fdt_setprop_namelen(void *fdt, int nodeoffset, const char *name,
* -FDT_ERR_BADLAYOUT,
* -FDT_ERR_TRUNCATED, standard meanings
*/
static inline int fdt_setprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len)
{
return fdt_setprop_namelen(fdt, nodeoffset, name, strlen(name), val,
len);
}
int fdt_setprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
/**
* fdt_setprop_placeholder_namelen - allocate space for a property
@ -2002,13 +1998,8 @@ int fdt_setprop_placeholder_namelen(void *fdt, int nodeoffset, const char *name,
* -FDT_ERR_BADLAYOUT,
* -FDT_ERR_TRUNCATED, standard meanings
*/
static inline int fdt_setprop_placeholder(void *fdt, int nodeoffset,
const char *name, int len,
void **prop_data)
{
return fdt_setprop_placeholder_namelen(fdt, nodeoffset, name,
strlen(name), len, prop_data);
}
int fdt_setprop_placeholder(void *fdt, int nodeoffset,
const char *name, int len, void **prop_data);
/**
* fdt_setprop_u32 - set a property to a 32-bit integer