mirror of
https://github.com/dgibson/dtc.git
synced 2026-01-22 01:30:34 -05:00
libfdt: Improve size savings in FDT_RO_PROBE slightly
In the case where we have set FDT_ASSUME_MASK to disable ASSUME_VALID_DTB checks, we can improve the FDT_RO_PROBE macro slightly. The first thing that fdt_ro_probe_() does when we can_assume(VALID_DTB) is true is to return whatever the contents of the totalsize field of the DTB is. Since the FDT_RO_PROBE macro only cares about a negative value there, we can optimize this check such that we are to assume it's a valid DTB, we don't need to do anything here. Signed-off-by: Tom Rini <trini@konsulko.com> Message-ID: <20251210022002.3004223-3-trini@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
b126924732
commit
39cae0bd00
1 changed files with 7 additions and 5 deletions
|
|
@ -11,11 +11,13 @@
|
|||
#define FDT_TAGALIGN(x) (FDT_ALIGN((x), FDT_TAGSIZE))
|
||||
|
||||
int32_t fdt_ro_probe_(const void *fdt);
|
||||
#define FDT_RO_PROBE(fdt) \
|
||||
{ \
|
||||
int32_t totalsize_; \
|
||||
if ((totalsize_ = fdt_ro_probe_(fdt)) < 0) \
|
||||
return totalsize_; \
|
||||
#define FDT_RO_PROBE(fdt) \
|
||||
{ \
|
||||
if (!can_assume(VALID_DTB)) { \
|
||||
int32_t totalsize_; \
|
||||
if ((totalsize_ = fdt_ro_probe_(fdt)) < 0) \
|
||||
return totalsize_; \
|
||||
} \
|
||||
}
|
||||
|
||||
int fdt_check_node_offset_(const void *fdt, int offset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue