Commit c2010a3b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

checkpatch: usb_free_urb() can take NULL

usb_free_urb() can take a NULL, so let's check and warn about that.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9214d1d8
...@@ -1889,6 +1889,13 @@ sub process { ...@@ -1889,6 +1889,13 @@ sub process {
WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev); WARN("kfree(NULL) is safe this check is probabally 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("usb_free_urb(NULL) is safe this check is probabally not required\n" . $hereprev);
}
}
# warn about #ifdefs in C files # warn about #ifdefs in C files
# if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { # if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
......
Markdown is supported
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