Messages in this thread | | | Date | Tue, 20 Nov 2012 13:55:03 +0530 | Subject | Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays | From | Viresh Kumar <> |
| |
On 20 November 2012 13:51, Shevchenko, Andriy <andriy.shevchenko@intel.com> 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
| |