提交 4c432a8f 编写于 作者: G Greg Kroah-Hartman 提交者: Linus Torvalds

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: NGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: NAndy Whitcroft <apw@shadowen.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f5fe35dd
......@@ -2078,6 +2078,13 @@ sub process {
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 probably not required\n" . $hereprev);
}
}
# warn about #ifdefs in C files
# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册