From: Greg Kroah-Hartman Date: Thu, 24 Jul 2008 04:29:04 +0000 (-0700) Subject: checkpatch: usb_free_urb() can take NULL X-Git-Tag: v2.6.27-rc1~704 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=4c432a8f0134504814aa8dcce6cc57c89d175604;p=linux-2.6-omap-h63xx.git 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: Greg Kroah-Hartman Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 13d7a330b5d..a4e8087a0ca 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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$/)) {