1. 07 Feb, 2012 1 commit
    • Joe Perches's avatar
      checkpatch: Warn on code with 6+ tab indentation · 8eef05dd
      Joe Perches authored
      
      
      Overly indented code should be refactored.
      
      Suggest refactoring excessive indentation of of
      if/else/for/do/while/switch statements.
      
      For example:
      
      $ cat t.c
      #include <stdio.h>
      #include <stdlib.h>
      
      int main(int argc, char **argv)
      {
      
      	if (1)
      		if (2)
      			if (3)
      				if (4)
      					if (5)
      						if (6)
      							if (7)
      								if (8)
      									;
      	return 0;
      }
      
      $ ./scripts/checkpatch.pl -f t.c
      WARNING: Too many leading tabs - consider code refactoring
      #12: FILE: t.c:12:
      +						if (6)
      
      WARNING: Too many leading tabs - consider code refactoring
      #13: FILE: t.c:13:
      +							if (7)
      
      WARNING: Too many leading tabs - consider code refactoring
      #14: FILE: t.c:14:
      +								if (8)
      
      total: 0 errors, 3 warnings, 17 lines checked
      
      t.c has style problems, please review.
      
      If any of these errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8eef05dd
  2. 11 Jan, 2012 15 commits
  3. 01 Nov, 2011 2 commits
  4. 15 Sep, 2011 1 commit
  5. 31 Aug, 2011 1 commit
    • Arnaud Lacombe's avatar
      script/checkpatch.pl: warn about deprecated use of EXTRA_{A,C,CPP,LD}FLAGS · c68e5878
      Arnaud Lacombe authored
      Usage of these flags has been deprecated for nearly 4 years by:
      
          commit f77bf014
      
      
          Author: Sam Ravnborg <sam@neptun.(none)>
          Date:   Mon Oct 15 22:25:06 2007 +0200
      
              kbuild: introduce ccflags-y, asflags-y and ldflags-y
      
      Moreover, these flags (at least EXTRA_CFLAGS) have been documented for command
      line use. By default, gmake(1) do not override command line setting, so this is
      likely to result in build failure or unexpected behavior.
      
      Warn about their introduction in Makefile or Kbuild files.
      
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Andy Whitcroft <apw@canonical.com>
      Signed-off-by: default avatarArnaud Lacombe <lacombar@gmail.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      c68e5878
  6. 25 Aug, 2011 1 commit
  7. 26 Jul, 2011 7 commits
  8. 16 Jun, 2011 1 commit
  9. 25 May, 2011 3 commits
  10. 31 Mar, 2011 1 commit
  11. 23 Mar, 2011 3 commits
    • Dave Jones's avatar
      checkpatch: warn about memset with swapped arguments · 309c00c7
      Dave Jones authored
      
      
      Because the second and third arguments of memset have the same type, it
      turns out to be really easy to mix them up.
      
      This bug comes up time after time, so checkpatch should really be checking
      for it at patch submission time.
      Signed-off-by: default avatarDave Jones <davej@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Andy Whitcroft <apw@shadowen.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      309c00c7
    • Mike Frysinger's avatar
      scripts/checkpatch.pl: reset rpt_cleaners warnings · b0781216
      Mike Frysinger authored
      
      
      If you run checkpatch against multiple patches, and one of them has a
      whitespace issue which can be helped via a script (rpt_cleaners), you will
      see the same NOTE over and over for all subsequent patches.  It makes it
      seem like those patches also have whitespace problems when in reality,
      there's only one or two bad apples.
      
      So reset rpt_cleaners back to 0 after we've issued the note so that it
      only shows up near the patch with the actual problems.
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Cc: Andy Whitcroft <apw@canonical.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b0781216
    • Alexey Dobriyan's avatar
      kstrto*: converting strings to integers done (hopefully) right · 33ee3b2e
      Alexey Dobriyan authored
      
      
      1. simple_strto*() do not contain overflow checks and crufty,
         libc way to indicate failure.
      2. strict_strto*() also do not have overflow checks but the name and
         comments pretend they do.
      3. Both families have only "long long" and "long" variants,
         but users want strtou8()
      4. Both "simple" and "strict" prefixes are wrong:
         Simple doesn't exactly say what's so simple, strict should not exist
         because conversion should be strict by default.
      
      The solution is to use "k" prefix and add convertors for more types.
      Enter
      	kstrtoull()
      	kstrtoll()
      	kstrtoul()
      	kstrtol()
      	kstrtouint()
      	kstrtoint()
      
      	kstrtou64()
      	kstrtos64()
      	kstrtou32()
      	kstrtos32()
      	kstrtou16()
      	kstrtos16()
      	kstrtou8()
      	kstrtos8()
      
      Include runtime testsuite (somewhat incomplete) as well.
      
      strict_strto*() become deprecated, stubbed to kstrto*() and
      eventually will be removed altogether.
      
      Use kstrto*() in code today!
      
      Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
            they'll be unused at runtime. This is temporarily solution,
            because I don't want to hardcode list of archs where these
            functions aren't needed. Current solution with sizeof() and
            __alignof__ at least always works.
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      33ee3b2e
  12. 27 Jan, 2011 1 commit
  13. 13 Jan, 2011 3 commits