Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346417
b: refs/heads/master
c: 03df4b5
h: refs/heads/master
i:
  346415: 765b59f
v: v3
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Dec 18, 2012
1 parent e4e79c6 commit 6fede8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78e3f1f01d23c1a0d5828669d35afa2e7951987d
refs/heads/master: 03df4b51f33e1fdd35fe7bc19f1f450726395207
20 changes: 6 additions & 14 deletions trunk/scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3198,20 +3198,12 @@ sub process {
$herecurr);
}

# check for needless kfree() checks
if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {
my $expr = $1;
if ($line =~ /\bkfree\(\Q$expr\E\);/) {
WARN("NEEDLESS_KFREE",
"kfree(NULL) is safe this check is probably not required\n" . $hereprev);
}
}
# check for needless usb_free_urb() checks
if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {
my $expr = $1;
if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) {
WARN("NEEDLESS_USB_FREE_URB",
"usb_free_urb(NULL) is safe this check is probably not required\n" . $hereprev);
# check for needless "if (<foo>) fn(<foo>)" uses
if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) {
my $expr = '\s*\(\s*' . quotemeta($1) . '\s*\)\s*;';
if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?)$expr/) {
WARN('NEEDLESS_IF',
"$1(NULL) is safe this check is probably not required\n" . $hereprev);
}
}

Expand Down

0 comments on commit 6fede8a

Please sign in to comment.