[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqJyaMDkj6jE+qk6AuUNB0-TOLdqeYDBdjH+1YJFu2V0DQ@mail.gmail.com>
Date: Mon, 27 Jan 2014 10:21:00 -0600
From: Rob Herring <robherring2@...il.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Grant Likely <grant.likely@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
David Howells <dhowells@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] of: Fix uninitialized child warning in
for_each_child_of_node() if !OF
On Mon, Jan 27, 2014 at 8:52 AM, Geert Uytterhoeven
<geert@...ux-m68k.org> wrote:
> On Mon, Jan 27, 2014 at 3:16 PM, Rob Herring <robherring2@...il.com> wrote:
>> On Sun, Jan 26, 2014 at 4:21 AM, Geert Uytterhoeven
>> <geert@...ux-m68k.org> wrote:
>>> If CONFIG_OF=n:
>>>
>>> drivers/i2c/i2c-mux.c: In function ‘i2c_add_mux_adapter’:
>>> drivers/i2c/i2c-mux.c:158: warning: ‘child’ is used uninitialized in this function
>>> drivers/leds/leds-lp55xx-common.c: In function ‘lp55xx_of_populate_pdata’:
>>> drivers/leds/leds-lp55xx-common.c:560: warning: ‘child’ is used uninitialized in this function
>>> drivers/leds/leds-pwm.c: In function ‘led_pwm_probe’:
>>> drivers/leds/leds-pwm.c:89: warning: ‘child’ is used uninitialized in this function
>>> drivers/mfd/stmpe.c: In function ‘stmpe_of_probe’:
>>> drivers/mfd/stmpe.c:1112: warning: ‘child’ is used uninitialized in this function
>>> drivers/mfd/tc3589x.c: In function ‘tc3589x_probe’:
>>> drivers/mfd/tc3589x.c:324: warning: ‘child’ is used uninitialized in this function
>>> drivers/power/charger-manager.c: In function ‘of_cm_parse_desc’:
>>> drivers/power/charger-manager.c:1606: warning: ‘child’ is used uninitialized in this function
>>>
>>> Introduced by commit 00b2c76a6abbe082bb5afb89ee49ec325e9cd4d2
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> ("include/linux/of.h: make for_each_child_of_node() reference its args when
>>> CONFIG_OF=n").
>>>
>>> Instead of dropping the "__of_use_dn(child)" again, explicitly set child
>>> to NULL, to protect against code using child after the loop (child == NULL
>>> is the loop termination condition if CONFIG_OF=y).
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
>>
>> Just got fixed in mainline:
>>
>> commit 00b2c76a6abbe082bb5afb89ee49ec325e9cd4d2
>
> Nope, this is the one that introduced new warnings.
Oh right, sorry. Read that too fast.
Won't your change trigger warnings from -Wunused-but-set-variable in
cases where child is not used? That would only be enabled for "W=1"
though.
I think the right fix here is all the for_each_X macros should not be
conditional on CONFIG_OF and we should rely on the functions they call
like of_get_next_child to do the right thing for !OF.
Rob
--
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