Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

From: Viresh Kumar
Date: Tue Nov 20 2012 - 03:24:56 EST


On 20 November 2012 13:51, Shevchenko, Andriy
<andriy.shevchenko@xxxxxxxxx> wrote:
> You could at least create macro to do a precheck if you want to.
>
> Like
> #define CHECK_PROP(prop, sz, out)
>
> {
> if (!prop)
> return -EINVAL;
> if (!prop->value)
> return -ENODATA;
> if ((sz * sizeof(*out)) > prop->length)
> return -EOVERFLOW;
> }

Hi Andriy,

Initially i started with a macro for the complete routine, but later as types
started to play important role in it, i have to split it to routines.

I thought of this idea to do prop check in a macro, but then i thought
it might cover a bigger range of files and so thought of doing that separately.
For, simplicity left it this time.

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/