[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKohpokkiawgUZvTKncj_15XC5BTsbi0s=WfxPwk6ci8VpqHAw@mail.gmail.com>
Date: Tue, 20 Nov 2012 13:55:03 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: "Shevchenko, Andriy" <andriy.shevchenko@...el.com>
Cc: "rob.herring@...xeda.com" <rob.herring@...xeda.com>,
"grant.likely@...retlab.ca" <grant.likely@...retlab.ca>,
"spear-devel@...t.st.com" <spear-devel@...t.st.com>,
"devicetree-discuss@...ts.ozlabs.org"
<devicetree-discuss@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linaro-dev@...ts.linaro.org" <linaro-dev@...ts.linaro.org>,
"patches@...aro.org" <patches@...aro.org>,
"swarren@...dotorg.org" <swarren@...dotorg.org>
Subject: Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays
On 20 November 2012 13:51, Shevchenko, Andriy
<andriy.shevchenko@...el.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists