mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-08 12:45:29 -05:00
Simplify string table access functions
The range sanity checking on the fdt_string_cmp() function causes problems for the sequential write code (or at least for using RO functions on an incomplete SW tree). Plus they didn't really fit with the philosphy for the RO code of working as widely as possible on weirdly constructed trees.
This commit is contained in:
parent
156649d4f6
commit
3aa4cfd66b
3 changed files with 8 additions and 24 deletions
7
fdt_ro.c
7
fdt_ro.c
|
|
@ -59,6 +59,11 @@ static int offset_streq(const struct fdt_header *fdt, int offset,
|
|||
return 1;
|
||||
}
|
||||
|
||||
char *fdt_string(const struct fdt_header *fdt, int stroffset)
|
||||
{
|
||||
return (char *)fdt + fdt32_to_cpu(fdt->off_dt_strings) + stroffset;
|
||||
}
|
||||
|
||||
int fdt_property_offset(const struct fdt_header *fdt, int nodeoffset,
|
||||
const char *name)
|
||||
{
|
||||
|
|
@ -103,7 +108,7 @@ int fdt_property_offset(const struct fdt_header *fdt, int nodeoffset,
|
|||
if (! prop)
|
||||
return OFFSET_ERROR(FDT_ERR_BADSTRUCTURE);
|
||||
namestroff = fdt32_to_cpu(prop->nameoff);
|
||||
if (fdt_string_cmp(fdt, namestroff, name) == 0)
|
||||
if (streq(fdt_string(fdt, namestroff), name))
|
||||
/* Found it! */
|
||||
return offset;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue