summaryrefslogtreecommitdiff
path: root/libfdt/fdt_rw.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-02-18 18:06:31 +1100
committerGerald Van Baren <vanbaren@cideas.com>2008-03-18 21:03:45 -0400
commitd0ccb9b140b472039732de102fc14597eedb14df (patch)
tree121a2e532df523cca768bafaf9cd527a1c00a295 /libfdt/fdt_rw.c
parentfe30a354cdbb808b5f15366a935b151a4ccee74f (diff)
downloadu-boot-imx-d0ccb9b140b472039732de102fc14597eedb14df.zip
u-boot-imx-d0ccb9b140b472039732de102fc14597eedb14df.tar.gz
u-boot-imx-d0ccb9b140b472039732de102fc14597eedb14df.tar.bz2
libfdt: Trivial cleanup for CHECK_HEADER)
Currently the CHECK_HEADER() macro is defined local to fdt_ro.c. However, there are a handful of functions (fdt_move, rw_check_header, fdt_open_into) from other files which could also use it (currently they open-code something more-or-less identical). Therefore, this patch moves CHECK_HEADER() to libfdt_internal.h and uses it in those places. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libfdt/fdt_rw.c')
-rw-r--r--libfdt/fdt_rw.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
index ac50195..0df472b 100644
--- a/libfdt/fdt_rw.c
+++ b/libfdt/fdt_rw.c
@@ -69,10 +69,8 @@ static int _blocks_misordered(const void *fdt,
static int rw_check_header(void *fdt)
{
- int err;
+ CHECK_HEADER(fdt);
- if ((err = fdt_check_header(fdt)))
- return err;
if (fdt_version(fdt) < 17)
return -FDT_ERR_BADVERSION;
if (_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
@@ -399,9 +397,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
int newsize;
void *tmp;
- err = fdt_check_header(fdt);
- if (err)
- return err;
+ CHECK_HEADER(fdt);
mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
* sizeof(struct fdt_reserve_entry);