From: Stephen Warren <swarren@wwwdotorg.org>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: linux-kernel@vger.kernel.org, Stephen Warren <swarren@nvidia.com>
Subject: Re: [PATCH] pwm: fix used-uninitialized warning in pwm_get()
Date: Thu, 05 Jul 2012 09:56:50 -0600 [thread overview]
Message-ID: <4FF5B942.6080101@wwwdotorg.org> (raw)
In-Reply-To: <20120704055828.GC18779@avionic-0098.mockup.avionic-design.de>
On 07/03/2012 11:58 PM, Thierry Reding wrote:
> On Tue, Jul 03, 2012 at 02:34:21PM -0600, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> This fixes: drivers/pwm/core.c: In function 'pwm_get':
>> drivers/pwm/core.c:534:15: warning: 'index' may be used
>> uninitialized in this function
>>
>> The addition to the if condition at end of the function isn't
>> strictly necessary to solve the warning, but does make it more
>> obvious that the initialization of "index" to a dummy value isn't
>> just hiding the problem.
>
> Actually this seems to be a false positive, and one that I don't
> see (I use GCC 4.6.3). index will be initialized when chip is set
> in the loop. My guess is that GCC 4.6.3 actually notices while your
> version doesn't.
Yes, it is a false-positive, which is why I was fine with just
initializing the variable to hide the warning rather than making some
other code change. I think there's still value in hiding the warning
though, so that:
a) Nobody else has to look at the warning and decide it's a false
positive and remember to ignore it.
b) The fewer warnings there are, the more likely new warnings will be
noticed and analyzed.
So I'd still argue for this change, or some other fix for the warning,
be merged.
next prev parent reply other threads:[~2012-07-05 15:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-03 20:34 [PATCH] pwm: fix used-uninitialized warning in pwm_get() Stephen Warren
2012-07-04 5:58 ` Thierry Reding
2012-07-05 15:56 ` Stephen Warren [this message]
2012-07-11 6:39 ` Thierry Reding
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=4FF5B942.6080101@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=swarren@nvidia.com \
--cc=thierry.reding@avionic-design.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox