On 6 November 2012 19:48, Rob Herring <robherri...@gmail.com> wrote:

> > diff --git a/drivers/of/base.c b/drivers/of/base.c
>


> > +#define of_property_read_array(_np, _pname, _out, _sz)
>       \
> > +     struct property *_prop = of_find_property(_np, _pname, NULL);   \
> > +     const __be32 *_val;                                             \
> > +                                                                     \
> > +     if (!_prop)                                                     \
> > +             return -EINVAL;                                         \
> > +     if (!_prop->value)                                              \
> > +             return -ENODATA;                                        \
> > +     if ((_sz * sizeof(*_out)) > _prop->length)                      \
> > +             return -EOVERFLOW;                                      \
> > +                                                                     \
> > +     _val = _prop->value;                                            \
> > +     while (_sz--)                                                   \
> > +             *_out++ = (typeof(*_out))be32_to_cpup(_val++);          \
>
> This will not work. You are incrementing _out by 1, 2, or 4 bytes, but
> _val is always incremented by 4 bytes.
>
> According to the dtc commit adding this feature, the values are packed:
>
> With this patch the following property assignment:
>
>     property = /bits/ 16 <0x1234 0x5678 0x0 0xffff>;
>
> is equivalent to:
>
>     property = <0x12345678 0x0000ffff>;
>

Something which i haven't expected :(
I will fix and test it well for all types before sending it now.


> > +/**
> > + * of_property_read_u8_array - Find and read an array of u8 from a
> property.
> > + *
> > + * @np:              device node from which the property value is to be
> read.
> > + * @propname:        name of the property to be searched.
> > + * @out_value:       pointer to return value, modified only if return
> value is 0.
> > + *
>
> Missing sz
>

Yes for both misses.
_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to