libfdt: Remove un-const-safe fdt_set_header macro

The fdt_set_header() macro casts an arbitrary pointer into (struct
fdt_header *) to set fdt header fields.  While we need to change the
type, so that we can use this macro on the usual (void *) used to
represent a device tree blob, the current macro also casts away any
const on the input pointer, which loses an important check.

This patch replaces the fdt_set_header() macro with a set of inline
functions, one for each header field which do a similar thing, but
which won't silently remove const from a given pointer.  This approach
is also more in keeping with the individual accessor macros we use for
reading fdt header fields.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
3 files changed