Kernel build warnings

valdis.kletnieks at vt.edu valdis.kletnieks at vt.edu
Tue Aug 8 02:18:19 EDT 2017


On Tue, 08 Aug 2017 05:36:34 -0000, Amit Kumar said:

> When I compile arm64/defconfig kernel with W=1, build emits a lot of
> warnings. When patch is required to be "build clean" then why warnings are
> there?  I want to understand.

The warnings that come out with the default W=0 are by an large indicative
of code that's syntactically correct, but probably *do* have unintended
semantics, so those should be fixed up properly.

The problem with W=1 is that although W=1 will generate a lot of warnings, a
lot of them are things we don't actually want to go out of our way to fix.
That's because W=1 turns on a *lot* of nitpicking "did you really mean to do
that?" warnings - and in kernel code, yes, we often really *did* mean to do
that.

Now, *some* of them do indeed call for fixing.  But make sure that you're
fixing an *actual* problem, where the warning indicates an actual bug.  All
too often, we get patches that just shut the warning up, and don't fix a
bug - or even worse, introduce bugs where there weren't any before.

There's also something to be said for fixing warnings that are in .h files,
because they end up emitting warnings for multiple .c files.  A while back,
I submitted a short series of "low hanging fruit" patches against the
drivers/staging/lustre tree - the big win was a one-liner that silenced a
macro in all 231 places it was used.  But again - make sure the patch is
an improvement, and not just papering over an issue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170808/443af072/attachment.bin 


More information about the Kernelnewbies mailing list