* Warning masked by BUG() when CONFIG_BUG is enabled
@ 2013-11-16 22:52 Arnaud Ebalard
2013-11-17 0:26 ` Russell King - ARM Linux
2013-11-17 14:06 ` [Cocci] " Wolfram Sang
0 siblings, 2 replies; 5+ messages in thread
From: Arnaud Ebalard @ 2013-11-16 22:52 UTC (permalink / raw)
To: Thomas Petazzoni, Jason Cooper, Andrew Lunn,
Sebastian Hesselbarth, Linus Walleij
Cc: linux-arm-kernel, linux-gpio, cocci, Julia Lawall
Hi,
While compiling a kernel, I got the following warnings which are due to
missing returns in the following functions:
CC fs/xattr.o
CC crypto/cryptd.o
CC lib/irq_regs.o
CC lib/is_single_threaded.o
CC lib/klist.o
drivers/gpio/gpio-mvebu.c: In function ‘mvebu_gpioreg_edge_mask’:
drivers/gpio/gpio-mvebu.c:148:1: warning: control reaches end of non-void function [-Wreturn-type]
drivers/gpio/gpio-mvebu.c: In function ‘mvebu_gpioreg_edge_cause’:
drivers/gpio/gpio-mvebu.c:130:1: warning: control reaches end of non-void function [-Wreturn-type]
drivers/gpio/gpio-mvebu.c: In function ‘mvebu_gpioreg_level_mask’:
drivers/gpio/gpio-mvebu.c:166:1: warning: control reaches end of non-void function [-Wreturn-type]
CC lib/kobject.o
CC lib/kobject_uevent.o
CC lib/md5.o
CC lib/percpu-refcount.o
I was kind of curious not to have noticed it during kernel builds for
armada 370/xp targets. The reason is the following: on my Armada 370/XP
builds, I had CONFIG_BUG=y which makes BUG() call panic() (which never
returns). Otherwise, BUG() is a nop and the 'default' branch below is no
more a catch-all barrier in previous functions. For the discussion,
those have the same structure:
static inline void __iomem *mvebu_gpioreg_edge_cause(...)
{
int cpu;
switch (mvchip->soc_variant) {
case MVEBU_GPIO_SOC_VARIANT_ORION:
case MVEBU_GPIO_SOC_VARIANT_MV78200:
return sth;
case MVEBU_GPIO_SOC_VARIANT_ARMADAXP:
return sth;
default:
BUG();
}
}
*Out of curiosity*, are there no generic solutions to handle such a case?
In the end, if BUG() has been put here on purpose (i.e. this is the only
solution, which it kinds of looks like here) wouldn't it be more logical
to call panic() here directly?
As a side note, I noticed quite some instances of that pattern (switch
statement w/ a 'default' calling BUG()) while more carefully looking at
compilation output. I may get slapped for this, but just in case this
is indeed something which deserves to be fixed and can be fixed
automagically via some semantic patch, I have CC'ed Coccinelle people.
Cheers,
a+
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Warning masked by BUG() when CONFIG_BUG is enabled
2013-11-16 22:52 Warning masked by BUG() when CONFIG_BUG is enabled Arnaud Ebalard
@ 2013-11-17 0:26 ` Russell King - ARM Linux
2013-11-17 0:36 ` Arnaud Ebalard
2013-11-17 14:06 ` [Cocci] " Wolfram Sang
1 sibling, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2013-11-17 0:26 UTC (permalink / raw)
To: Arnaud Ebalard
Cc: Thomas Petazzoni, Jason Cooper, Andrew Lunn,
Sebastian Hesselbarth, Linus Walleij, linux-gpio, cocci,
linux-arm-kernel, Julia Lawall
On Sat, Nov 16, 2013 at 11:52:08PM +0100, Arnaud Ebalard wrote:
> I was kind of curious not to have noticed it during kernel builds for
> armada 370/xp targets. The reason is the following: on my Armada 370/XP
> builds, I had CONFIG_BUG=y which makes BUG() call panic() (which never
> returns).
You're not the first to spot this, and you won't be the last.
Some very experienced kernel hackers have tried to get this fixed and
failed. It seems people actually want the CPU to fall through the
BUG() sites when people disable CONFIG_BUG - which I think is idiotic.
Arnd (and myself) have worked on this problem, and we came up with a
very nice solution which didn't increase the size of the kernel and
didn't make things unsafe. However, it went nowhere.
It's pointless trying to get this fixed - it's just a complete waste of
time because of politics. Find something else to attack. Just ensure
you always have CONFIG_BUG enabled if you want a system which will
produce some kind of report when one of these sites gets hit.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Warning masked by BUG() when CONFIG_BUG is enabled
2013-11-17 0:26 ` Russell King - ARM Linux
@ 2013-11-17 0:36 ` Arnaud Ebalard
0 siblings, 0 replies; 5+ messages in thread
From: Arnaud Ebalard @ 2013-11-17 0:36 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Thomas Petazzoni, Jason Cooper, Andrew Lunn,
Sebastian Hesselbarth, Linus Walleij, linux-gpio, cocci,
linux-arm-kernel, Julia Lawall
Hi Russell,
Russell King - ARM Linux <linux@arm.linux.org.uk> writes:
> On Sat, Nov 16, 2013 at 11:52:08PM +0100, Arnaud Ebalard wrote:
>> I was kind of curious not to have noticed it during kernel builds for
>> armada 370/xp targets. The reason is the following: on my Armada 370/XP
>> builds, I had CONFIG_BUG=y which makes BUG() call panic() (which never
>> returns).
>
> You're not the first to spot this, and you won't be the last.
>
> Some very experienced kernel hackers have tried to get this fixed and
> failed. It seems people actually want the CPU to fall through the
> BUG() sites when people disable CONFIG_BUG - which I think is idiotic.
>
> Arnd (and myself) have worked on this problem, and we came up with a
> very nice solution which didn't increase the size of the kernel and
> didn't make things unsafe. However, it went nowhere.
>
> It's pointless trying to get this fixed - it's just a complete waste of
> time because of politics. Find something else to attack. Just ensure
> you always have CONFIG_BUG enabled if you want a system which will
> produce some kind of report when one of these sites gets hit.
Understood. Thanks for the explanation.
Cheers,
a+
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Cocci] Warning masked by BUG() when CONFIG_BUG is enabled
2013-11-16 22:52 Warning masked by BUG() when CONFIG_BUG is enabled Arnaud Ebalard
2013-11-17 0:26 ` Russell King - ARM Linux
@ 2013-11-17 14:06 ` Wolfram Sang
2013-11-17 14:47 ` Julia Lawall
1 sibling, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2013-11-17 14:06 UTC (permalink / raw)
To: Arnaud Ebalard
Cc: Thomas Petazzoni, Jason Cooper, Andrew Lunn,
Sebastian Hesselbarth, Linus Walleij, linux-gpio, cocci,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 598 bytes --]
> As a side note, I noticed quite some instances of that pattern (switch
> statement w/ a 'default' calling BUG()) while more carefully looking at
> compilation output. I may get slapped for this, but just in case this
> is indeed something which deserves to be fixed and can be fixed
> automagically via some semantic patch, I have CC'ed Coccinelle people.
I don't think this can be fixed in a generic way. This driver, for
example, should IMO return -EINVAL when hitting default in probe and
simply get rid of the other BUG() calls. No need to halt the kernel
because of a broken match->data.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Cocci] Warning masked by BUG() when CONFIG_BUG is enabled
2013-11-17 14:06 ` [Cocci] " Wolfram Sang
@ 2013-11-17 14:47 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2013-11-17 14:47 UTC (permalink / raw)
To: Wolfram Sang
Cc: Arnaud Ebalard, Thomas Petazzoni, Andrew Lunn, Jason Cooper,
Linus Walleij, linux-gpio, cocci, linux-arm-kernel,
Sebastian Hesselbarth
> > As a side note, I noticed quite some instances of that pattern (switch
> > statement w/ a 'default' calling BUG()) while more carefully looking at
> > compilation output. I may get slapped for this, but just in case this
> > is indeed something which deserves to be fixed and can be fixed
> > automagically via some semantic patch, I have CC'ed Coccinelle people.
>
> I don't think this can be fixed in a generic way. This driver, for
> example, should IMO return -EINVAL when hitting default in probe and
> simply get rid of the other BUG() calls. No need to halt the kernel
> because of a broken match->data.
One could nevertheless perhaps use Coccinelle to find them, if there is
some possibility to fix them.
julia
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-17 14:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-16 22:52 Warning masked by BUG() when CONFIG_BUG is enabled Arnaud Ebalard
2013-11-17 0:26 ` Russell King - ARM Linux
2013-11-17 0:36 ` Arnaud Ebalard
2013-11-17 14:06 ` [Cocci] " Wolfram Sang
2013-11-17 14:47 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).