* Re: [PATCH] regmap: debugfs: Fix compilation warning
[not found] <1358779015-25735-1-git-send-email-v-stehle@ti.com>
@ 2013-01-22 6:41 ` Mark Brown
2013-01-22 10:07 ` Vincent Stehlé
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-01-22 6:41 UTC (permalink / raw)
To: Vincent Stehlé; +Cc: linux-kernel, trivial
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
On Mon, Jan 21, 2013 at 03:36:55PM +0100, Vincent Stehlé wrote:
> This fixes the following compilation warning:
> - unsigned int i, ret;
> + unsigned int i, ret = 0;
This sort of fix is not a good idea, you're just shutting the warning up
without any sort of analysis explaining why it's generated in error. If
it's generating a spurious error that's a compiler bug.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regmap: debugfs: Fix compilation warning
2013-01-22 6:41 ` [PATCH] regmap: debugfs: Fix compilation warning Mark Brown
@ 2013-01-22 10:07 ` Vincent Stehlé
2013-01-23 15:58 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Stehlé @ 2013-01-22 10:07 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel
On 01/22/2013 07:41 AM, Mark Brown wrote:
(..)
> This sort of fix is not a good idea, you're just shutting the
> warning up without any sort of analysis explaining why it's
> generated in error. If it's generating a spurious error that's a
> compiler bug.
In the regmap_debugfs_get_dump_start() function control flow, I think
the compiler cannot know for sure that the list_for_each_entry()
iterates at least once.:
regmap_debugfs_get_dump_start()
{
unsigned int ret;
<snip some code, which does not touch ret>
list_for_each_entry() {
<snip some code>
ret = <value>;
}
return ret;
}
Do you think there is a way to "mark" the list_for_each_entry() as
iterating at least once? an __attribute__ maybe?
Best regards,
V.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regmap: debugfs: Fix compilation warning
2013-01-22 10:07 ` Vincent Stehlé
@ 2013-01-23 15:58 ` Mark Brown
2013-01-24 10:12 ` Vincent Stehlé
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-01-23 15:58 UTC (permalink / raw)
To: Vincent Stehlé; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 227 bytes --]
On Tue, Jan 22, 2013 at 11:07:04AM +0100, Vincent Stehlé wrote:
> Do you think there is a way to "mark" the list_for_each_entry() as
> iterating at least once? an __attribute__ maybe?
No - but are you sure that's true?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regmap: debugfs: Fix compilation warning
2013-01-23 15:58 ` Mark Brown
@ 2013-01-24 10:12 ` Vincent Stehlé
2013-01-26 10:02 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Stehlé @ 2013-01-24 10:12 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel
On 01/23/2013 04:58 PM, Mark Brown wrote:
> On Tue, Jan 22, 2013 at 11:07:04AM +0100, Vincent Stehlé wrote:
>
>> Do you think there is a way to "mark" the list_for_each_entry()
>> as iterating at least once? an __attribute__ maybe?
>
> No - but are you sure that's true?
If you mean "am I sure the loop iterates at least once", then yes, as
we have an explicit check just before the concerned list_for_each_entry():
/*
* This should never happen; we return above if we fail to
* allocate and we should never be in this code if there are
* no registers at all.
*/
if (list_empty(&map->debugfs_off_cache)) {
WARN_ON(list_empty(&map->debugfs_off_cache));
return base;
}
Best regards,
V.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regmap: debugfs: Fix compilation warning
2013-01-24 10:12 ` Vincent Stehlé
@ 2013-01-26 10:02 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-01-26 10:02 UTC (permalink / raw)
To: Vincent Stehlé; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
On Thu, Jan 24, 2013 at 11:12:24AM +0100, Vincent Stehlé wrote:
> If you mean "am I sure the loop iterates at least once", then yes, as
> we have an explicit check just before the concerned list_for_each_entry():
So, I hadn't realised this was triggered by a new compiler version -
Arnd just tried the same bodge. I've committed a workaround for the
compiler which avoids the problems that setting 0 will have and allows
the flow analyis to run where it can.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-26 10:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1358779015-25735-1-git-send-email-v-stehle@ti.com>
2013-01-22 6:41 ` [PATCH] regmap: debugfs: Fix compilation warning Mark Brown
2013-01-22 10:07 ` Vincent Stehlé
2013-01-23 15:58 ` Mark Brown
2013-01-24 10:12 ` Vincent Stehlé
2013-01-26 10:02 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox