Re: [PATCH v15 06/16] of/fdt: add helper functions for handling properties
From: David Gibson
Date: Tue Oct 09 2018 - 20:58:54 EST
On Tue, Oct 09, 2018 at 11:02:29AM -0700, Frank Rowand wrote:
> On 10/04/18 22:06, AKASHI, Takahiro wrote:
[snip]
> >>>> +int fdt_setprop_reg(void *fdt, int nodeoffset, const char *name,
> >>>> + u64 addr, u64 size)
> >>>> +{
> >>>> + int addr_cells, size_cells;
> >>
> >> unsigned
> >
> > fdt_[address|size]_cell() returns an int.
>
> I stand corrected. They take advantage of the fact that valid values
> are in the range 0..4 and return a negative value for error.
I'm not sure if the spec formally defines that these values will fit
in a positive 'int'. But if addresses are 8GiB each, you're going to
have much bigger problems putting it in a device tree than this
function.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature