Commit 1e855726 authored by Wolfram Sang's avatar Wolfram Sang Committed by Linus Torvalds
Browse files

checkpatch: Add warning for p0-patches

Some people work internally with -p0-patches which has the danger that one
forgets to convert them to -p1 before mainlining.  Bitten myself and seen
p0-patches in mailing lists occasionally, this patch adds a warning to in case a patch is -p0.  If you really want, you can fool
this check to generate false positives, this is why it just spits a
warning.  Making the check 100% proof is trickier than it looks, so let's
start with a version which catches the cases of real use.

[ update message language, handle null prefix, add tests]
Signed-off-by: default avatarWolfram Sang <>
Signed-off-by: default avatarAndy Whitcroft <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 2a5a2c25
......@@ -1057,6 +1057,7 @@ sub process {
my $in_comment = 0;
my $comment_edge = 0;
my $first_line = 0;
my $p1_prefix = '';
my $prev_values = 'E';
......@@ -1205,7 +1206,12 @@ sub process {
# extract the filename as it passes
if ($line=~/^\+\+\+\s+(\S+)/) {
$realfile = $1;
$realfile =~ s@^[^/]*/@@;
$realfile =~ s@^([^/]*)/@@;
$p1_prefix = $1;
if ($tree && $p1_prefix ne '' && -e "$root/$p1_prefix") {
WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
if ($realfile =~ m@^include/asm/@) {
ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment