On Thu, Sep 24, 2015 at 09:25:06AM +0200, Olliver Schinagl wrote:What i ment is, without strcmp, the loop would test for:
Hey list, Mika,We default to "gpios". So if you pass "reset" we actually look for
With commit 0d9a693cc86 the following snippet of code was added:
+ /* Try first from _DSD */
+ for (i = 0; i < ARRAY_SIZE(suffixes); i++) {
+ if (con_id && strcmp(con_id, "gpios")) {
+ snprintf(propname, sizeof(propname), "%s-%s",
+ con_id, suffixes[i]);
and I was wondering why the gpios suffix is singled out. Are we not allowed
to check for all the strings in the suffixes array? Is gpios special or is
gpio simply not allowed. If that strcmp check would be removed, would bad
things happen?
proprerty "reset-gpios". This is the recommend syntax AFAIK.
I just looked it up and of course you are right and I learned something new:
Also, just to educate myself, isn't relying on left to right parsing'&&' is so called short circuit operator so if we already know that
complier specifc? E.g. if con_id is null, we end up passing NULL to strcmp
and atleast for libc can cause segfaults iirc.
con_id is NULL we never evaluate the remaining conditions.