From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Simon Guinot <simon.guinot@sequanux.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
linux-leds@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2 v2] leds: netxbig: silence a static checker warning
Date: Mon, 13 Apr 2015 07:35:19 +0000 [thread overview]
Message-ID: <552B71B7.3000100@samsung.com> (raw)
In-Reply-To: <20150410195224.GJ1509@kw.sim.vm.gnt>
On 04/10/2015 09:52 PM, Simon Guinot wrote:
> On Fri, Apr 10, 2015 at 06:50:34PM +0300, Dan Carpenter wrote:
>> I've looked at this some more. Most of the places which call
>> of_property_read_u32_index() check the return code. The ones that don't
>> mostly initialize their values going in. The remainder introduce static
>> checker warnings like:
>>
>> drivers/clk/ti/divider.c:472 ti_clk_get_div_table()
>> error: potentially using uninitialized 'val'.
>>
>> These warnings cause me pain. It calls of_get_property() earlier so
>> it won't return -EINVAL. I don't know if it can return -ENODATA or
>> -EOVERFLOW?
>>
>> I guess not.
>
> I think it can't. Above, we are calling of_property_count_u32_elems() to
> count the number of u32 elements in the "timers" property. After we are
> ensuring that there is three u32 elements available per timer. That's
> why the return codes for the three of_property_read_u32_index() calls
> are not checked.
After looking at Documentation/devicetree/bindings/leds/leds-netxbig.txt
I noticed inconsistency: timers property is defined as required, but
the comment over the call to of_property_count_u32_elems says that it
is optional.
I think that DT documentation should be changed to make the property
optional. How do you think?
Besides, I am wondering if we shouldn't check if the values read are
sane? In such a case initializing delay_on and delay_off to 0 would be
useful. We could check if both delays don't equal 0, which could happen
if the of_property_read_u32_index returned negative value because of
providing values out of bounds or not numerical values.
--
Best Regards,
Jacek Anaszewski
WARNING: multiple messages have this Message-ID (diff)
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Simon Guinot <simon.guinot@sequanux.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
linux-leds@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2 v2] leds: netxbig: silence a static checker warning
Date: Mon, 13 Apr 2015 09:35:19 +0200 [thread overview]
Message-ID: <552B71B7.3000100@samsung.com> (raw)
In-Reply-To: <20150410195224.GJ1509@kw.sim.vm.gnt>
On 04/10/2015 09:52 PM, Simon Guinot wrote:
> On Fri, Apr 10, 2015 at 06:50:34PM +0300, Dan Carpenter wrote:
>> I've looked at this some more. Most of the places which call
>> of_property_read_u32_index() check the return code. The ones that don't
>> mostly initialize their values going in. The remainder introduce static
>> checker warnings like:
>>
>> drivers/clk/ti/divider.c:472 ti_clk_get_div_table()
>> error: potentially using uninitialized 'val'.
>>
>> These warnings cause me pain. It calls of_get_property() earlier so
>> it won't return -EINVAL. I don't know if it can return -ENODATA or
>> -EOVERFLOW?
>>
>> I guess not.
>
> I think it can't. Above, we are calling of_property_count_u32_elems() to
> count the number of u32 elements in the "timers" property. After we are
> ensuring that there is three u32 elements available per timer. That's
> why the return codes for the three of_property_read_u32_index() calls
> are not checked.
After looking at Documentation/devicetree/bindings/leds/leds-netxbig.txt
I noticed inconsistency: timers property is defined as required, but
the comment over the call to of_property_count_u32_elems says that it
is optional.
I think that DT documentation should be changed to make the property
optional. How do you think?
Besides, I am wondering if we shouldn't check if the values read are
sane? In such a case initializing delay_on and delay_off to 0 would be
useful. We could check if both delays don't equal 0, which could happen
if the of_property_read_u32_index returned negative value because of
providing values out of bounds or not numerical values.
--
Best Regards,
Jacek Anaszewski
next prev parent reply other threads:[~2015-04-13 7:35 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 9:07 [patch 2/2] leds: netxbig: clean up a data type issue Dan Carpenter
2015-04-09 9:07 ` Dan Carpenter
2015-04-09 19:25 ` Simon Guinot
2015-04-09 19:25 ` Simon Guinot
2015-04-09 19:25 ` Simon Guinot
2015-04-09 19:54 ` Dan Carpenter
2015-04-09 19:54 ` Dan Carpenter
2015-04-09 19:54 ` Dan Carpenter
2015-04-10 0:25 ` Simon Guinot
2015-04-10 0:25 ` Simon Guinot
2015-04-10 0:25 ` Simon Guinot
2015-04-10 8:30 ` [patch 2/2 v2] leds: netxbig: silence a static checker warning Dan Carpenter
2015-04-10 8:30 ` Dan Carpenter
2015-04-10 14:18 ` Jacek Anaszewski
2015-04-10 14:18 ` Jacek Anaszewski
2015-04-10 14:30 ` Dan Carpenter
2015-04-10 14:30 ` Dan Carpenter
2015-04-10 14:41 ` Simon Guinot
2015-04-10 14:41 ` Simon Guinot
2015-04-10 15:50 ` Dan Carpenter
2015-04-10 15:50 ` Dan Carpenter
2015-04-10 19:52 ` Simon Guinot
2015-04-10 19:52 ` Simon Guinot
2015-04-13 7:35 ` Jacek Anaszewski [this message]
2015-04-13 7:35 ` Jacek Anaszewski
2015-04-13 10:16 ` Simon Guinot
2015-04-13 10:16 ` Simon Guinot
2015-04-13 10:54 ` Jacek Anaszewski
2015-04-13 10:54 ` Jacek Anaszewski
2015-04-13 10:16 ` Dan Carpenter
2015-04-13 10:16 ` Dan Carpenter
2015-04-10 14:30 ` Simon Guinot
2015-04-10 14:30 ` Simon Guinot
2015-04-13 8:25 ` Gregory CLEMENT
2015-04-13 8:25 ` Gregory CLEMENT
2015-04-13 9:20 ` Simon Guinot
2015-04-13 9:20 ` Simon Guinot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=552B71B7.3000100@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=cooloney@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=rpurdie@rpsys.net \
--cc=simon.guinot@sequanux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.