Re: kdbus: to merge or not to merge?

Joe Perches
2015-07-09T10:29:56Z

On Thu, 2015-07-09 at 10:39 +0200, Geert Uytterhoeven wrote:
> On Wed, Jul 8, 2015 at 3:54 PM, Pavel Machek <pavel@ucw.cz> wrote:
> > Apparently, new tools are needed in the community, as normal review
> > comments did not stop drivers/android/binder.c merge.
> >
> > For example binder_transaction does not exactly look like a kernel
> > code, "TODO: fput" does not really invoke confidence, and amount of
> > BUG_ON()s is quite amazing...
>
> Amazingly, checkpatch (without --strict) only complains about long lines.
>
> Seems like the test for "BUG" is (and always has been) commented out...

Maybe (requires --strict when scanning files)
---
scripts/checkpatch.pl | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 90e1edc..11c8186 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3439,13 +3439,15 @@ sub process {
}
}

-# # no BUG() or BUG_ON()
-# if ($line =~ /\b(BUG|BUG_ON)\b/) {
-# print "Try to use WARN_ON & Recovery code rather than BUG() or BUG_ON()\n";
-# print "$herecurr";
-# $clean = 0;
-# }
+# avoid BUG() or BUG_ON()
+ if ($line =~ /\b(?:BUG|BUG_ON)\b/) {
+ my $msg_type = \&WARN;
+ $msg_type = \&CHK if ($file);
+ &{$msg_type}("AVOID_BUG",
+ "Avoid crashing the kernel - Try using WARN_ON & Recovery code rather than BUG() or BUG_ON()\n" . $herecurr);
+ }

+# avoid LINUX_VERSION_CODE
if ($line =~ /\bLINUX_VERSION_CODE\b/) {
WARN("LINUX_VERSION_CODE",
"LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr);